Revision 1.3
Omega File System
Published 11th of April 1999
by Lasse Krogh Thygesen
Purpose
The purpose of the Omega Partition Format (OPF) is to provide a safe format for organizing data on harddrives. The format has been designed to minimize wasted space from clusters/sectors. The cluster/sectors in the
OPF are 512 bytes in length.
2 - How it works
The
OPF consist of the following elements:
The
LBA address used in this specification are relative to the first
LBA address of the partition. The later address is defined in the
MBR.
Bootstrap + Partion Structure Data
This area is loaded by the bootmanager into memory and executed. It contains the secondary boot code which loads the operating system files. It also contains information on how big the SUM1/2 and LFAT1/2 data areas are.
Structure of the MBR sector
Offset | Size | Description |
0000h - 0003h | 4 | Assemble code: jmp 0080h |
0004h - 000Ch | 8 | Partition serialnumber |
0025h - 002Eh | 10 | LBA address location of SUM 1 |
002Fh - 0038h | 10 | LBA address location of SUM 2 (If 10x00h then none) |
0039h - 0042h | 10 | Length of each SUM (Counting sectors) |
0043h - 004Ch | 10 | LBA address location of LFAT 1 |
004Dh - 0056h | 10 | LBA address location of LFAT 2 (If 10x00h then none) |
0057h - 0060h | 10 | Length of each LFAT (Counting sectors) |
0000h - 0000h | 10 | LFAT id for the OS Launch program |
0000h - 0000h | 128 | Partition name |
0000h - 0000h | 31 | Reserved |
0000h - 0000h | 4 | Omega Partitionformat signature (r1 - 14020100) |
Partition serialnumber
A partition serialnumber which, at least should be unique in a given system. If two or more simelair numbers are found then the system should change them so that no partitions on a given system will have the same serialnumber. These serialnumbers are intended to be used when assigning drive numbers or mounting partitions in the directory hierachi.
LFAT entry for the OS Launch program
The LFAT id number makes it easy for the bootmanager or similair code to load the OS Launch program. The only thing it has to do is calculate the
LBA address which hold the LFAT entry, load it, read the information and load the OS Launch program to memory.
Partition name
Very usefull for giving the partitions user friendly names.
SUM - Sector Usage Map
Each bit in this area represent a sector on the drive. If the sector contains data then this bit is 1, if not this bit is set to 0. By using this area the system can easily determine which sectors are available. The use of two maps are a protection feature against any faults in this critical system area. This protection features can be disable by setting the
LBA address of the second map to 0.
LFAT - Logical File Allocation Table
All the data on the drive are logical organized in files and directories. This
Logical
File
Allocation
Table defines which data in the partition belongs to which files. The directory structure only exist inside the LFAT. The use of two tables are a protection feature against any faults in this critical system area. This protection features can be disabled by setting the
LBA address of the second table to 0. Each entry in the LFAT takes 252 bytes of space. This makes room for 2 entries in each sector. At offset 01FCh each LFAT sector contains the LFAT signature (14020101h). The two entries have the following layout, with bases at 0000h and 0100h:
Structure of a LFAT entry
Offset | Size | Description |
0000h - 0003h | 10 | LFAT ID |
0000h - 0003h | 10 | Parent LFAT directory entry. (10x00h if none) |
0000h - 0003h | 128 | Filename |
0000h - 0003h | 7 | Creation date (DD-MM-YYYY TT-MM-SS) |
0000h - 0003h | 7 | Last save date (DD-MM-YYYY TT-MM-SS) |
0000h - 0003h | 10 | First File Segment Header (LBA address) |
0000h - 0003h | 12 | Length of logical file (Counting bytes) |
0000h - 0003h | 1 | Level of fragmentation |
0000h - 0003h | 2 | Status code |
0000h - 0003h | 4 | Owner ID |
0000h - 0003h | 4 | Group ID |
0000h - 0003h | 1 | Owner Permission Flag |
0000h - 0003h | 1 | Group Permission Flag |
0000h - 0003h | 1 | Others Permission Flag |
0000h - 0003h | 57 | Reserved |
LFAT Id
This is a unique number by which the entry is recognized. Note that entry 0 is always defined as the root of the directory structure.
Parent LFAT directory entry
In the directory structure this is the directory entry in which the entry is logical placed. If the entry is located in the root this must be set to entry 0.
Filename
The name of the file/directory/object. This can be any of the 256 caraters from the ASCII table.
Dates
The creation date marks the time when the entry was created. This date can't be changed. The last save date marks the time when the file was last written or partially written.
Note: Systems could set the creation date when deleting an entry.
This
LBA address is the location of where the file's data is located on the disc. If the file is fragmented the address should be of the first filesegment. More about Data Segment and File Segment Header (FSH) later. For LFAT directory entries the FSH should be 10x00h.
Level of fragmentation
May be set by the disk service routines, for later use with deframentation.
Status code
The two bytes should be read as 4 values ranging from 0 to F in the hexadecimal system. Usually the two bytes are shown as xx xx, where position 1 is the one on the left.
Structure of the status codes
Position | Usage |
1 - Hide information:
|
0 = Not hidden
1 = Hidden for low priviledge program
3 = Hidden for user
2 = Hidden for high priviledge program
F = Hidden for all but OS
|
2 - Protection info.:
|
0 = Not protected
1 = Erase protected
2 = Write protected
3 = Read protected for low priviledge program
4 = Read protected for high priviledge program
F = Protected for all but OS
|
3 - Owner information:
|
0 = Public
1 = Shared
2 = Program
3 = User
F = System
|
4 - Type information:
|
0 = Not used / Deleted file
1 = Deleted directory
2 = File
3 = Directory
4 = Directory List
5 = Link
|
Owner ID / Group ID
For use with the OS security mechanism. A user with the same ID as the Owner ID (the actual owner of the file) may perform the operations which the Owner Permission Flag allow. User which are members of a group with the same ID as the Group ID field, may perform the operations which the Group Permission Flag allow. And finally other user may perform the operations which the Others Permission Flag allow.
Owner / Group / Others Permission Flags
The Owner Permission Flag describes what the owner may do with the object. The Group Permission Flag describes what members of the group may do with the object. And the Others Permission Flag describes what other users may do with the object. The format of the Permission Flags are:
Structure of the Permission Flags
7 |
6 |
5 |
4 |
3 |
2 |
1 |
0 |
Reserved |
Executable |
Linkable |
Writable |
Readable |
Data area
This area is where the actual data is located.
Each segment of a file has it own File Segment Header. This 512 bytes preceeding every datasegment in the partition, holds information about which LFAT entry the segment belongs to, how long the file is, and if the data segment is part of a fragmented file, it contains the
LBA address of the previous filesegment, and the next filesegment, the length of this datasegment, and the offset from the start of the file.
Maximum capacity
As the sectors are identified by a 10 bytes (80 bit) number, the total number of addressable sectors are 1.2089e24, which is around 524288 * 1.073.741.824 Terabyte. This is a rather big number, so the capacity will not be a problem in the near future.
Advantages & Disadvantages
As every datasegent need a FSH, the minimum disc usage for a file would be 2 * 512 bytes (512 for the FSH and 512 for the minimum cluster size). At some time there may become a free discspace of 512 bytes, between two datasegments. This free space won't be available until one of the segments around it is moved (Forexampel by a disc utility program).
When a file is very fragmented it may influence the system performace, because the drive needs to move its head a lot. This can be solved by running a disc utility program to defragment the files.
Tips
- An OS may build a directory tree in memory to speed up filehandling.
- When harddrive activity is low or none, the OS could launch a program which clean and optimizes the drive.
Changes from previous revision
- 1.3 - Changed a lot.
- 1.2 - Changed some errors in the definitions.
- 1.1 - Changed almost all of the definitions.
- 1.0 - First revision published.