[BUG] VFAT eats directory entries on read errors?

Xuân Baldauf (xuan--lkml--2003.07.01@baldauf.org)
Tue, 01 Jul 2003 20:56:22 +0200


Hello,

I accidently mounted the wrong partition (which was a VFAT32 partition)
of a 2.5" IDE hard drive which was attached to the IDE bus of a desktop
box for diagnostics.

ls -la /mount/point

showed only parts of the root directory of the filesystem, some error
messages were printed onto the console indicating read errors. For some
seconds, there was some calm but strange sound created by the computer.
It seemed that (due to the lousy adapter between IDE bus cable and the
HD) there was a cable error and thus some blocks could not be read. Some
seconds later (when there was no strange sound to be listened anymore) I
tried to verify that communication between HD and host worked fine using
dd. There were no read erros.

Because I did not want to access that partition, I unmounted the FAT32
partition and continued to work on another partition.

Unfortunately, booting Windows from this FAT32 partition did not work
anymore. There were files missing which belong to the root directory.
Repair tools like "dosfsck" or "chkdsk" did not report any problem or
possibility to save the contents of the root directory. (Maybe "dosfsck"
is too destructive...) The only directory entries which were not missing
were the directory entries which were displayed by the former "ls -la".

The Linux vfat code (2.4.21-pre5) actually cut the directory! (And
destroyed data.) The partition had been mounted with no special options
(thus, it was mounted read-write). But there was no write access by some
user. It seems that the vfat module interpreted non-readable blocks
belonging to the root directory as non-existent blocks and that the vfat
module rewrited that cut directory to disk.

Maybe someone enlightened could try to reproduce such a scenario where
some blocks of the root directory cannot be read. (Error simulation is
does not seems to be possible without a specially modified kernel.)

Xuân.

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