[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: dos filesystem check
From: |
Andrew Clausen |
Subject: |
Re: dos filesystem check |
Date: |
Sat, 23 Mar 2002 10:15:36 +1100 |
User-agent: |
Mutt/1.3.17i |
On Wed, Mar 20, 2002 at 10:40:36AM +0000, Richard Hirst wrote:
> Hi,
> If you create a file system with an odd number of sectors and then use
> the linux mkdosfs to create a FAT filesystem on it, and then do a parted
> check on that, you get:
>
> > address@hidden:/build/dosfstools/dosfstools-2.8$ sudo parted -s /dev/sdc
> > check 1
> > Warning: Partition size (64197 sectors) and filesystem size (64196 sectors)
> > do not match.
> > You found a bug in GNU Parted. Please email a bug report to address@hidden
> > containing the version (1.4.24), and the following message:
> >
> > There are no possible configurations for this FAT type.
> > address@hidden:/build/dosfstools/dosfstools-2.8$ echo $?
> > 0
>
> mkdosfs actually does a binary search up the disk to find the highest
> numbered sector it can read, and linux doesn't let you read the last odd
> sector of a block device directly. So, mkdosfs concludes that the
> partition size is one sector less than the real size. A bug in mkdosfs,
> maybe; parted behaves like Microsoft s/w in this case.
Definitely a bug in mkdosfs... MS s/w might corrupt/misinterpret
the mkdosfs file system.
> Also, having decided there is a bug, parted really shouldn't exit with
> code 0.
Weird... it should! Could you please debug this? I can't reproduce
(easily). If it's too much trouble for you, I can investigate.
> In addition:
>
> > (parted) p
> > Disk geometry for /dev/sdc: 0.000-4095.856 megabytes
> > Disk label type: msdos
> > Minor Start End Type Filesystem Flags
> > 1 0.031 31.376 primary FAT
> > 2 101.975 196.105 primary FAT
> > 3 298.081 902.087 primary FAT
> > 4 996.218 4000.561 primary FAT
> > (parted) mkfs 3 fat
> > Warning: Would you like to use FAT32 for this filesystem? It is much more
> > efficient with your disk space, but is not compatible with early versions
> > of Windows 95 and Windows NT. Only select yes if you only use Linux, BSD,
> > MS Windows 98 and/or MS Windows 95 B.
> > Yes No Cancel ? y
> > (parted) check 3
> > Warning: File system is reporting the free space as 154493 clusters, not
> > 154318 clusters.
> > Ignore Cancel ?
>
> So something seems amiss with it's creation/checking of FAT32. All this
> with parted 1.4.
Right. I fixed this in 1.6.x, but I want to "make sure" it's right
before backporting. (I haven't heard any complaints about 1.6.x,
so maybe it's ok?) Making/resizing FAT file systems is very tricky,
and there is no documentation... (The problem isn't well defined)
This case doesn't arise very much, so it hasn't been a practical
problem. Very long story. (see the archives, and comments in
libparted/fs_fat/calc.c)
Maybe I should be more scientific about it... it's a rather long
and tedious job of trying lots of different partition sizes,
and checking how chkdsk & friends react. The problem is, they're
not very verbose, so there's a bit of math involved too... :(
Andrew