Page 1 of 1
[SOLVED] FAT12 and root directory
Posted: Sun Jun 23, 2013 3:11 am
by HugeCode
Hi all. I have been looking on FAT12 filesystem and there are few things I don't understand. I have summarized them in few questions:
- Is the number of root directory entries (and logicaly size of root directory) changable by operating system, or it's only maximal limit of entries set by formatting program?
- Is the root directory also listed in FAT table (as it is for FAT32), or every calculation of cluster's sector must add the number of sectors reserved by root directory?
- Are the entries of clusters which don't physicaly exists (entries exist, because sectors of FAT table are 512-byte aligned as any other sectors, but there is no place on floppy for them) filled with some special value?
Thanks.
Re: FAT12 and root directory
Posted: Sun Jun 23, 2013 3:26 am
by Kazinsal
HugeCode wrote:Is the number of root directory entries (and logicaly size of root directory) changable by operating system, or it's only maximal limit of entries set by formatting program?
If the number of root directory entries is 224, you've got 224 entries to work with. No more. If it says 16, it's 16. The root directory is a fixed structure.
I suppose if you really wanted to you could do an OS-specific extension where a specifically-named directory in the root directory acts as an extension to the root directory if it exists, but there is no standard for such a thing.
Re: FAT12 and root directory
Posted: Sun Jun 23, 2013 3:37 am
by egos
HugeCode wrote:Is the number of root directory entries (and logicaly size of root directory) changable by operating system, or it's only maximal limit of entries set by formatting program?
The 2nd variant.
Is the root directory also listed in FAT table (as it is for FAT32), or every calculation of cluster's sector must add the number of sectors reserved by root directory?
The 2nd variant.
Are the entries of clusters which don't physicaly exists (entries exist, because sectors of FAT table are 512-byte aligned as any other sectors, but there is no place on floppy for them) filled with some special value?
Such entries are undefined. You shouldn't use them.
Re: FAT12 and root directory
Posted: Sun Jun 23, 2013 10:28 am
by HugeCode
Blacklight and egos, thanks.
egos: Can I predict that number of root entries will be (at least) multiply of 16? (512/32)
Re: FAT12 and root directory
Posted: Sun Jun 23, 2013 11:49 am
by egos
Yes. Additionally in the FS driver you can check this field during FS detection.
Re: FAT12 and root directory
Posted: Mon Jun 24, 2013 6:46 am
by qw
Re: FAT12 and root directory
Posted: Wed Jun 26, 2013 5:28 pm
by Casm
In the FAT12 and FAT16 file systems the root directory is allocated a fixed number of sectors following the file allocation tables, and it is not itself considered a file. Therefore it doesn't appear in the FAT.
If I remember rightly, 1.44mb floppies have a maximum of 224 root directory entries at 32 bytes per entry.
Re: FAT12 and root directory
Posted: Wed Jun 26, 2013 9:05 pm
by HugeCode
casm: Is there some special reson for number 224?
Re: FAT12 and root directory
Posted: Thu Jun 27, 2013 1:28 am
by Yoda
Casm, you may create floppy with any root dir entries number round to sector size.
Re: FAT12 and root directory
Posted: Thu Jun 27, 2013 7:08 am
by Casm
HugeCode wrote:casm: Is there some special reson for number 224?
I was only quoting from memory, and a quick calculation suggests it might have been 288. That would give you two FAT12s, and a boot sector, on head 0 of track 0, with a 288 entry root directory occupying the whole of head 1 on track 0.
The above scheme would leave 96 out of 2880 sectors unaddressable. If that bothered you, you would have to have the second FAT overflowing onto head 1 of the floppy, leaving you with a slightly smaller root directory.
Re: FAT12 and root directory
Posted: Thu Jun 27, 2013 8:12 am
by HugeCode
Ok. Thank you.