SFS: Difference between revisions

From OSDev.wiki
Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content added Content deleted
(Major Edit - Add Simplifcation and condensation of SimpleFS Spec)
m (simple add 's' to 'http')
 
(17 intermediate revisions by 11 users not shown)
Line 1: Line 1:
{{Filesystems}}
{{Filesystems}}


'''SFS''' is a filesystem by Brendan Trotter, designed to be very easy to implement. It has a minimal set of features. Officially it is still in its draft stage, but hasn't changed over past year.
There are several filesystems existing that are abbreviated '''SFS''', but the one discussed here is the '''Simple File System''' by Brendan Trotter, designed to be very easy to implement. It has a minimal set of features. Officially it is still in its draft stage, but hasn't changed for some time.


SFS is designed to be used as a simple filesystem for use on floppy disks and other removable media to transfer data between computers.
SFS is designed to be used as a simple filesystem for use on floppy disks and other removable media to transfer data between computers.
Line 9: Line 9:
There are five key areas in a SimpleFS partition: The Super-block, Reserved Area, Data Area, Free Area and Index Area.
There are five key areas in a SimpleFS partition: The Super-block, Reserved Area, Data Area, Free Area and Index Area.
=== Super-block ===
=== Super-block ===
The Super-block is located in the MBR, but could be in the boot sector, and contains structural information about the partition. The SFS data of the super-block is located at offset 0x194 and is 58 bytes long, leaving space for boot code and a partition table.
The Super-block is located in the first sector of a disk or partition. For floppy disks that means it is contained in the boot sector. The superblock contains structural information about the partition. The SFS data of the super-block is located at offset 0x0194 and is 58 bytes long, leaving space for boot code and a partition table.
{| class="wikitable"
{|
|-
|-
! Offset
! Offset
Line 16: Line 16:
! Contents
! Contents
|-
|-
| 0x194
| 0x0194
| 8
| 8
| Last alteration time of super-block values (Data size or Index Size)
| Last alteration time of super-block values (Data size or Index Size)
Line 26: Line 26:
| 0x01A4
| 0x01A4
| 8
| 8
| Size of Index Area in _bytes_
| Size of Index Area in <u>bytes</u>
|-
|-
| 0x01AC
| 0x01AC
| 3
| 3
| Magic number (0x534653)
| Magic number (0x534653 'SFS')
|-
|-
| 0x01AF
| 0x01AF
Line 46: Line 46:
| 0x01BC
| 0x01BC
| 1
| 1
| Block size given by BytesPerBlock = 2<pow>(BlockSize + 7)</pow>
| Block size given by ''BytesPerBlock = 2<sup>(BlockSize + 7)</sup>''
|-
|-
| 0x01BD
| 0x01BD
Line 63: Line 63:


=== Index Area ===
=== Index Area ===
/Note: Because the Index Area is situated at the end of the disk the offsets are referred to in an opposite fashion to what is typical. So, the first entry is actually the closest to the end of the disk/
''Note: Because the Index Area is situated at the end of the disk the offsets are referred to in an opposite fashion to what is typical. So, the first entry is actually the closest to the end of the disk''

The Index Area contains the tracking information for the Data Area and is made of a variable number of 64 byte entries extending from the end of the volume towards the beginning.
The Index Area contains the tracking information for the Data Area and is made of a variable number of 64 byte entries extending from the end of the volume towards the beginning.
The entries in the Index Area follow a few simple rules.
The entries in the Index Area follow a few simple rules.
The "first" (at the end of the disk) entry must be a Volume Identifier entry, this is used to detect if a disk has been swapped when auto-detection is unavailable. The "last" (closest to the start of the disk) must be a Starting Marker entry, this is used for file-system recovery if the super-block is damaged.
The "first" (at the end of the disk) entry must be a Volume Identifier entry, this is used to detect if a disk has been swapped when auto-detection is unavailable. The "last" (closest to the start of the disk) must be a Starting Marker entry, this is used for file-system recovery if the super-block is damaged.
Continuation entries are used to allow longer file names than can be placed in a single directory or file entry and immediately precede their respective file/directory entry.
Continuation entries are used to allow longer file names than can be placed in a single directory or file entry and immediately precede their respective file/directory entry.

=== Embedding ===
The GUID currently in use for GPT partitions is 4ebf0e06-11bf-450c-1a06-534653534653


== Information Formatting ==
== Information Formatting ==
Line 73: Line 77:
All SFS timestamps are 64-bit signed values that count the number of 1/65536<sup>ths</sup> of a second before or after the UNIX Epoch (1<sup>st</sup> of January 1970) and are in UTC.
All SFS timestamps are 64-bit signed values that count the number of 1/65536<sup>ths</sup> of a second before or after the UNIX Epoch (1<sup>st</sup> of January 1970) and are in UTC.
=== Names ===
=== Names ===
Name Strings in SFS must be null terminated and can include any character in the ranges 0x20-0x7E and 0xA1-0xFF excluding a double quote ("), asterisk (*), colon (:), less than or greater then sign (< or >), question mark (?) or backward slash (\).
Name Strings in SFS are in UTF-8 and must be null terminated. Characters can include any character in the ranges 0x20-0x7E and 0xA1-0xFF excluding a double quote ("), asterisk (*), colon (:), less than or greater then sign (< or >), question mark (?) or backward slash (\). The forwards slash (/) is admissible only as a path separator.
Note that UTF-8 means that the characters above 0x80 take up multiple bytes rather than one, which could confuse ASCII based systems.
The forwards slash (/) is admissible only as a path separator.

== External Links ==
* [http://dimensionalrift.homelinux.net/combuster/vdisk/sfs.html Official Specification]
* [http://dimensionalrift.homelinux.net/combuster/vdisk/ A windows utility for SFS images]


== Threads ==
== See Also ==
=== Threads ===
* [[Topic:11833|SFS Review thread]]
* [[Topic:11833|SFS Review thread]]
=== External Links ===
* [https://www.d-rift.nl/combuster/vdisk/sfs.html Official Specification] ([https://web.archive.org/web/20090923015653/http://dimensionalrift.homelinux.net/combuster/vdisk/sfs.html web.archive.org])
* [https://www.d-rift.nl/combuster/vdisk/ A windows utility for SFS images] ([https://web.archive.org/web/20111111113756/http://dimensionalrift.homelinux.net/combuster/vdisk/ web.archive.org])
* [https://www.fysnet.net/blog/files/sfs.pdf Ben Lunt's specification] (updated 13 Jan 2022) (not 100% compatible with the original, has more features) (version 1.10)


[[Category:Filesystems]]
[[Category:Filesystems]]
[[de:SFS]]

Latest revision as of 01:49, 24 January 2022

Filesystems
Virtual Filesystems

VFS

Disk Filesystems
CD/DVD Filesystems
Network Filesystems
Flash Filesystems

There are several filesystems existing that are abbreviated SFS, but the one discussed here is the Simple File System by Brendan Trotter, designed to be very easy to implement. It has a minimal set of features. Officially it is still in its draft stage, but hasn't changed for some time.

SFS is designed to be used as a simple filesystem for use on floppy disks and other removable media to transfer data between computers.

Format Details

Layout

There are five key areas in a SimpleFS partition: The Super-block, Reserved Area, Data Area, Free Area and Index Area.

Super-block

The Super-block is located in the first sector of a disk or partition. For floppy disks that means it is contained in the boot sector. The superblock contains structural information about the partition. The SFS data of the super-block is located at offset 0x0194 and is 58 bytes long, leaving space for boot code and a partition table.

Offset Size Contents
0x0194 8 Last alteration time of super-block values (Data size or Index Size)
0x019C 8 Size of Data Area in blocks
0x01A4 8 Size of Index Area in bytes
0x01AC 3 Magic number (0x534653 'SFS')
0x01AF 1 Version number in BCD (0x10 = 1.0)
0x01B0 8 Total number of blocks in volume
0x01B8 4 Size of Reserved Area and Super-block in blocks
0x01BC 1 Block size given by BytesPerBlock = 2(BlockSize + 7)
0x01BD 1 Checksum of bytes between 0x1AC and 0x1BC such that the lower 8 bits are zero

Reserved Area

The reserved area is a segment of disk that is untouched by drivers conforming to the current specification. This allows ancillary information or data such as a kernel image or a small EXT2/FAT partition to be stored on the same volume.

Data Area

The Data Area contains file data and starts at the end of the Reserved Area. The files in the data area can only occupy sequential areas as there is no way of linking chains of blocks for a single file.

Free Area

The Free Area is the currently unused space in the volume that can be used by either the Data Area growing downwards or the Index Area growing upwards.

Index Area

Note: Because the Index Area is situated at the end of the disk the offsets are referred to in an opposite fashion to what is typical. So, the first entry is actually the closest to the end of the disk

The Index Area contains the tracking information for the Data Area and is made of a variable number of 64 byte entries extending from the end of the volume towards the beginning. The entries in the Index Area follow a few simple rules. The "first" (at the end of the disk) entry must be a Volume Identifier entry, this is used to detect if a disk has been swapped when auto-detection is unavailable. The "last" (closest to the start of the disk) must be a Starting Marker entry, this is used for file-system recovery if the super-block is damaged. Continuation entries are used to allow longer file names than can be placed in a single directory or file entry and immediately precede their respective file/directory entry.

Embedding

The GUID currently in use for GPT partitions is 4ebf0e06-11bf-450c-1a06-534653534653

Information Formatting

Timestamps

All SFS timestamps are 64-bit signed values that count the number of 1/65536ths of a second before or after the UNIX Epoch (1st of January 1970) and are in UTC.

Names

Name Strings in SFS are in UTF-8 and must be null terminated. Characters can include any character in the ranges 0x20-0x7E and 0xA1-0xFF excluding a double quote ("), asterisk (*), colon (:), less than or greater then sign (< or >), question mark (?) or backward slash (\). The forwards slash (/) is admissible only as a path separator. Note that UTF-8 means that the characters above 0x80 take up multiple bytes rather than one, which could confuse ASCII based systems.

See Also

Threads

External Links