Filesystem

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Anon

Filesystem

Post by Anon »

What filesystems leave at least sectors 0-4 (1-5) free? I know fat doesn't, so how do OSes that use FAT go to the second-stage loader (assuming they don't read the FAT in the bootloader)? Windows uses 8 sectors I think, so how do they do it? What filesystems are there that leave those sectors free?

It is possible to keep the second-stage on a RAW partition, but that seems like a waste to me...
jamethiel

RE:Filesystem

Post by jamethiel »

Most native UNIX-type filesystems leave the first few K of the disk free for just this purpose.

FAT can be... convinced... to leave a few sectors available at the start of the disk if necessary, but you have to format it that way in the first place, it's not exactly easy to retrofit.

DOS and Windows bootloaders have FAT-parsing code in the bootsector.
(As of FAT32, the Windows bootblock runs to about 3 sectors, but all the previous FAT bootblocks fit in 512 bytes and parsed the FAT tables to load at least the first couple sectors of the second stage.)
Anon

RE:Filesystem

Post by Anon »

What filesystems support it? Does Ext2/3fs?
geezer

RE:Filesystem

Post by geezer »

>Most native UNIX-type filesystems leave the first few K of the disk free for just this purpose.

ext2 leaves the first 1024 bytes of the volume empty. The superblock is always at offset 1024, whatever the block size. If you have 1K blocks, then block 0 is empty, and block 1 is the superblock. If you have 4K blocks, then the superblock is inside block 0 (at offset 1024).

>FAT can be... convinced... to leave a few sectors available at the start of the disk

MS-DOS help for FORMAT says this about the "/B" option:

Reserves space for the system files IO.SYS and MSDOS.SYS (as hidden
files) on a newly formatted disk. In previous versions of MS-DOS, it was
necessary to reserve this space before using the SYS command to copy the
system files to the disk. This switch is maintained in MS-DOS version
6.0 for compatibility reasons only.

>DOS and Windows bootloaders have FAT-parsing code in the bootsector.

I don't know about FAT32, but FAT12 and FAT16 use the same loader, which just finds IO.SYS and loads the first 3 or 4 sectors of the file. These sectors must be contiguous -- the FAT12/16 bootsector doesn't even look at the FAT.
Post Reply