FAT dirty flag

Albert D. Cahalan (acahalan@cs.uml.edu)
Sun, 8 Nov 1998 16:52:43 -0500 (EST)


It looks like "struct fat_boot_sector" in msdos_fs.h is wrong for
FAT16 filesystems as used by Windows NT 4.0. I have a boot sector
that matches Microsoft knowledge base article Q140418 instead.
The differences start where "struct fat_boot_sector" claims to
hold FAT32 information, so I guess it needs a union.

(so the byte at offset 37 should be 1 while the filesystem is mounted)

00 .<.MSDOS5.0..... eb 3c 90 4d 53 44 4f 53 35 2e 30 0 2 8 1 0
10 ........?.@.?... 2 0 2 0 0 f8 0 1 3f 0 40 0 3f 0 0 0
20 A.....)1.O!MS-DO 41 ff 7 0 80 0 29 31 9e 4f 21 4d 53 2d 44 4f
30 S_6 FAT16 3. 53 5f 36 20 20 20 46 41 54 31 36 20 20 20 33 c0

Field Offset Length

8086 jump 0 3
OEM ID 3 8

Bytes Per Sector 11 2
Sectors Per Cluster 13 1
Reserved Sectors 14 2
FATs 16 1
Root Entries 17 2
Small Sectors 19 2
Media Descriptor 21 1
Sectors Per FAT 22 2
Sectors Per Track 24 2
Heads 26 2
Hidden Sectors 28 4
Large Sectors 32 4

Physical Drive Number 36 1
Current Head 37 1 <--- now a dirty flag
Signature 38 1
ID 39 4
Volume Label 43 11
System ID 54 8

Sectors Per Track and Heads: These values are a part of the apparent
disk geometry in use when the disk was formatted.

Physical Drive Number: This is related to the BIOS physical drive number.
Floppy drives are numbered starting with 0x00 for the A: drive, while
physical hard disks are numbered starting with 0x80. Typically, you would
set this value prior to issuing an INT 13 BIOS call in order to specify the
device to access. The on-disk value stored in this field is typically
0x00 for floppies and 0x80 for hard disks, regardless of how many physical
disk drives exist, because the value is only relevant if the device is a
boot device.

Current Head: This is another field typically used when doing INT13 BIOS
calls. The value would originally have been used to store the track on
which the boot record was located, but the value stored on disk is not
currently used as such. Therefore, Windows NT uses this field to store
two flags:
- The low order bit is a dirty flag, used to indicate that autochk
should run chkdsk against the volume at boot time.
- The second lowest bit is a flag indicating that a surface scan should
also be run.

Signature: The extended boot record signature must be either 0x28 or 0x29
in order to be recognized by Windows NT.

ID: The ID is a random serial number assigned at format time in order to
aid in distinguishing one disk from another.

Volume Label: This field was used to store the volume label, but the volume
label is now stored as a special file in the root directory.

System ID: This field is either FAT12 or FAT16 depending on the format
of the disk.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/