From mboxrd@z Thu Jan 1 00:00:00 1970 From: "H. Peter Anvin" Subject: Re: FAT-filesystem EOF marker problem Date: 24 Sep 2002 12:34:22 -0700 Sender: linux-fsdevel-owner@vger.kernel.org Message-ID: References: <20020923031804.GA16248@win.tue.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7BIT Return-path: Received: (from root@localhost) by neon-gw.transmeta.com (8.9.3/8.9.3) id MAA00932 for ; Tue, 24 Sep 2002 12:34:39 -0700 Received: from palladium.transmeta.com (palladium.transmeta.com [10.1.1.46]) by deepthought.transmeta.com (8.11.6/8.11.6) with ESMTP id g8OJYOA19248 for ; Tue, 24 Sep 2002 12:34:24 -0700 (PDT) Received: (from mail@localhost) by palladium.transmeta.com (8.9.3/8.9.3) id MAA02752 for linux-fsdevel@vger.kernel.org; Tue, 24 Sep 2002 12:34:24 -0700 To: linux-fsdevel@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org Followup to: By author: "Randy.Dunlap" In newsgroup: linux.dev.fs.devel > | > | My docs say: FAT entry 0 contains the media descriptor byte. > | FAT entry 1 contains the EOF marker, except that the high order two > | bits can be used for other purposes. > > And the value that I see there is 0xfff. > Fat entry 0 contains the media descriptor byte, and fat entry 1 *used* to contain the EOC mark, but has been retconned as the volume dirty bit (Microsoft OSs don't recognize a volume dirty flag for FAT12, however; this is presumably because of the MS assumption that FAT12 == floppy.): 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. Either way, I vote we should always use all ones of the EOC mark. -hpa -- at work, in private! "Unix gives you enough rope to shoot yourself in the foot." http://www.zytor.com/~hpa/puzzle.txt