clean unmount?
hi everybody!
can anyone tell me how at bootup time the filesystem is checked for clean unmount,i mean which flags are set by umount() and checked at bootup time(paricularly the FAT filesystem).also which part of code checks this thing and calls 'fsck' prog. if necessary.
regards
vijarnia
Quoted 9 lines
can anyone tell me how at bootup time the filesystem is checked for clean unmount,i mean which flags are set by
umount()and checked at bootup time(paricularly the FAT filesystem).also which part of code checks this thing and calls 'fsck'
prog. if necessary.
The fsck gets called unconditionally; Depending on invocation options, Fsck determines whether the filesystem was unmounted cleanly and based on the results, does or does not scan the filesystem.
I don't know how the "clean unmount" information is represented in FAT. Frankly, I'm surprised it is at all, since DOS doesn't have fsck.
I also don't know which program in your system calls 'fsck'; it varies from one system to the next. But it's in one of the startup scripts; it shouldn't be hard to locate.
Quoted 2 lines · Bryan Henderson
I don't know how the "clean unmount" information is represented in FAT. Frankly, I'm surprised it is at all, since DOS doesn't have fsck.
Hmm.. I saw it mentioned somewhere... ah, found it:
OSR2 includes versions of the Io.sys and Win.com files that check the Clean Shutdown and Hard Disk Error bits in the Virtual File Allocation Table (VFAT) during startup. If either of these bits is turned on (that is, cleared to 0) on any drive present in real mode, you are prompted to run ScanDisk.
The Clean Shutdown and Hard Disk Error bits are the two low-order bits of the FAT entry for cluster 1. If bit 0 is 0, it indicates an unclean shutdown; if bit 1 is 0, it indicates that a hard disk error occurred on that drive. These bits are turned on by VFAT; they are turned off only by ScanDisk. The Clean Shutdown bit is turned off upon completion of a standard run. The Hard Disk Error bit is turned off upon completion of a surface scan (regardless of whether errors were repaired).
If either of these bits is on for a real-mode drive, Win.com displays the appropriate error message.
Signature · 3 lines
"It's not Hollywood. War is real, war is primarily not about defeat or victory, it is about death. I've seen thousands and thousands of dead bodies. Do you think I want to have an academic debate on this subject?" -- Robert Fisk
Quoted 8 lines · Matthew Wilcox
Quoted 1 line
I don't know how the "clean unmount" information is represented in FAT.
OSR2 includes versions of the Io.sys and Win.com files that check the Clean Shutdown and Hard Disk Error bits in the Virtual File Allocation Table (VFAT) during startup. If either of these bits is turned on (that is, cleared to 0) on any drive present in real mode, you are prompted to run ScanDisk.
Quoted 7 lines
The Clean Shutdown and Hard Disk Error bits are the two low-order bits of the FAT entry for cluster 1. If bit 0 is 0, it indicates an unclean shutdown; if bit 1 is 0, it indicates that a hard disk error occurred on that drive. These bits are turned on by VFAT; they are turned off only by ScanDisk. The Clean Shutdown bit is turned off upon completion of a standard run. The Hard Disk Error bit is turned off upon completion of a surface scan (regardless of whether errors were repaired).
My docs say "high-order" instead of "low-order".
Are there people with a Windows system so that they can check?
Andries
Followup to: <[email protected]> By author: Andries Brouwer <[email protected]> In newsgroup: linux.dev.fs.devel
Quoted 8 lines
My docs say "high-order" instead of "low-order".
Are there people with a Windows system so that they can check?Andries
The FAT spec claims it's the high bits, which makes sense because 0x..FF8 and 0x..FFF are all technically valid EOCs (in fact, Linux for a long time wrote 0x...FF8 instead of the correct 0x...FFF):
For FAT16 and FAT32, the file system driver may use the high two bits of the FAT[1] entry for dirty volume flags (all other bits, are always left set to 1). Note that the bit location is different for FAT16 and FAT32, because they are the high 2 bits of the entry. For FAT16:
ClnShutBitMask = 0x8000; HrdErrBitMask = 0x4000; For FAT32:
ClnShutBitMask = 0x08000000; HrdErrBitMask = 0x04000000; Bit
ClnShutBitMask If bit is 1, volume is clean . If bit is 0, volume
is dirty . This indicates that the file system driver did not Dismount the volume properly the last time it had the volume mounted. It would be a good idea to run a Chkdsk/Scandisk disk repair
utility on it, because it may be damaged. Bit HrdErrBitMask If this
bit is 1, no disk read/write errors were encountered. If this bit is 0, the file system driver encountered a disk I/O error on the Volume the last time it was mounted, which is an indicator that some sectors may have gone bad on the volume. It would be a good idea to run a Chkdsk/Scandisk disk repair utility that does surface analysis on it to look for new bad sectors.
Signature · 3 lines
<[email protected]> at work, <[email protected]> in private! "Unix gives you enough rope to shoot yourself in the foot." Architectures needed: ia64 m68k mips64 ppc ppc64 s390 s390x sh v850 x86-64