fsck.vfat detects errors on pristine mkfs.vfat filesystem
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
dosfstools (Ubuntu) |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
Ubuntu 8.04, dosfstools 2.11-2.3ubuntu1.
mkfs.vfat creates a filesystem which initially passes fsck.vfat's
checks.
$ dd if=/dev/zero of=fat.fs bs=1k count=1k
1024+0 records in
1024+0 records out
1048576 bytes (1.0 MB) copied, 0.0404714 s, 25.9 MB/s
$
$ mkfs -t vfat -F 32 -v fat.fs
mkfs.vfat 2.11 (12 Mar 2005)
fat.fs has 64 heads and 32 sectors per track,
logical sector size is 512,
using 0xf8 media descriptor, with 2048 sectors;
file system has 2 32-bit FATs and 1 sector per cluster.
FAT size is 16 sectors, and provides 1984 clusters.
Volume ID is 498c32bb, no volume label.
$
$ fsck.vfat -n fat.fs
dosfsck 2.11, 12 Mar 2005, FAT32, LFN
fat.fs: 0 files, 1/1984 clusters
$
However, then put a file on the filesystem and fsck.vfat thinks there's
a problem.
$ mkdir mnt
$ sudo mount -o loop fat.fs mnt
$ sudo dd if=/dev/urandom of=mnt/foo bs=1k count=100
100+0 records in
100+0 records out
102400 bytes (102 kB) copied, 0.0760562 s, 1.3 MB/s
$ sudo umount mnt
$
$ fsck.vfat -n fat.fs
dosfsck 2.11, 12 Mar 2005, FAT32, LFN
Free cluster summary wrong (1983 vs. really 1783)
Auto-
Leaving file system unchanged.
fat.fs: 1 files, 201/1984 clusters
$
At least one of the kernel's filesystem code or dosfstool's fsck is
wrong. For a LTS release I don't think it's acceptable. I think there
was probably nothing wrong with my operational FS, but I let fsck.vfat
try and fix it, which didn't go well, and ended up loosing it. (I had
backups.)
Trying the above with 8.10's dosfstools 2.11-5 doesn't exhibit the same
problem; it appears fixed.
I am unable to test this on a hardy machine at this time, but can confirm that it has the same behaviour on gutsy and that it has been fixed on intrepid.
Gutsy: 2.11-2.2ubuntu1 - confirmed
Hardy: 2.11-2.3ubuntu1 - confirmed
Intrepid: 2.11-5 - does not have a problem