Bug 129631 - FAT32 filesystem corruption when using directories with extended characters
Summary: FAT32 filesystem corruption when using directories with extended characters
Alias: None
Product: Fedora
Classification: Fedora
Component: kernel
Version: 2
Hardware: i686
OS: Linux
Target Milestone: ---
Assignee: Dave Jones
QA Contact:
Depends On:
Blocks: FC3Target FC4Target
TreeView+ depends on / blocked
Reported: 2004-08-11 05:56 UTC by John William
Modified: 2015-01-04 22:08 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2005-04-16 04:34:55 UTC

Attachments (Terms of Use)

Description John William 2004-08-11 05:56:14 UTC
Description of problem:
1) I mounted my FAT32 volume on my Win2K dual-boot machine:
"mount /dev/hda dos -o uid=user,gid=user"
2) I mounted a SAMBA filesystem
"mount //server/share samba -o ro,user=roshare"
3) Run my program. My program traverses the directory tree in both 
the SAMBA volume and the FAT32 volume and makes sure the two contain 
exactly the same files and directories. If there are files or folders 
in the source that do not appear in the destination (or binary 
comparison fails) then the files (and/or folders) are copied from the 
source to the destination. When the program run is complete, the 
FAT32 directory tree should be an exact copy of the SAMBA tree.

My program runs into problems when using folder names with extended 
characters (like accented characters). I use readdir() to get 
filenames (which I store in a char array) and then do a mkdir() to 
create the folders. I use fread() and fwrite() to copy the files.

I observed the problem in the following way:

A comparison between the same folder name on the SAMBA and the FAT32 
volumes failed (even though the names were the same to Win2K), 
prompting my program to create a new folder with the name retrieved 
from the SAMBA share.

When the directory was created, all the extended characters were 
replaced with "?". After some time, the FAT32 volume started behaving 
strangely, giving I/O errors on writing files and read only device 
errors, when it was clearly mounted rw. Unmounting the FAT32 volume 
and remounting it makes the problem go away. I don't know how many 
folders/files it takes before the problem reappears as this is a 
batch program copying tens of thousands of files and thousands of 

I have been running this program under Cygwin for many months without 
problem, so I rebooted into Win2K to run the program again and that 
is when I noticed the filesystem corruption. When Win2K repaired the 
disk, it complained about invalid allocation units for each of the 
folders in question and all the files in each folder were lost.

As this is a slave machine that is synchronizing to a file server, I 
tried repeating the problem and was able to get filesystem corruption 
each time (but I couldn't tell if the same folders or different 
folders were lost each time).

Version-Release number of selected component (if applicable):

How reproducible:
Every time.

Steps to Reproduce:
(See description)
Actual results:
File system corruption. Directory strings compare as not equal on 
FAT32 and SAMBA shares when they should be identical.

Expected results:
No filesystem corruption, at least.

Additional info:
Marking bug as high priority as I get file system corruption.

Comment 1 Dawid Gajownik 2004-11-03 20:25:33 UTC
I do not know how related is my problem with your bug report but using
option utf8 helped me with non-US-ASCII characters.

BTW Maybe vfat filesystem type more suitable than dos for FAT32

Comment 2 Dawid Gajownik 2004-11-03 20:27:28 UTC
I missed one word - there should be "_is_ more suitable".

Comment 3 nathan wray 2004-11-12 17:06:03 UTC
Hi, I'm having a similar or the same problem under FC2.  I have a USB
drive formatted FAT32.  When connected to XP or OSX I can create a
folder with an umlat-o in the name (Björk).  This folder also exists
on a local drive (ext3) and is shared correctly via samba.  When I try
to copy the folder from the ext3 drive to the fat32 drive (mounted
vfat) the copy fails.  When I copy the folder via samba on osx or xp
it copys correctly.  when I mount the drive back on FC2 and look at
the folder name the umlat-o is replaced by a "?" character.

I don't understand the comment to try UTF8, this does not seem to be a
mount option for vfat.

Comment 4 Dawid Gajownik 2004-11-12 17:40:25 UTC
> When I try to copy the folder from the ext3 drive to the fat32 drive
(mounted vfat) the copy fails.
Does option "quiet" helps?

> I don't understand the comment to try UTF8, this does not seem to be
a mount option for vfat.

yum install kernel-doc
less /usr/share/doc/kernel-doc-2.6.9/Documentation/filesystems/vfat.txt

"utf8=<bool>   -- UTF8 is the filesystem safe version of Unicode that
		 is used by the console.  It can be be enabled for the
		 filesystem with this option. If 'uni_xlate' gets set,
		 UTF8 gets disabled."

Without that option I'm not able to see Polish chatacters (Ä,Ä,Ä,ż, etc.)

Right now I have something like this in the /etc/fstab file:

/dev/hda1  /mnt/FreeDOS  vfat 
0 0

Comment 5 Dave Jones 2004-12-08 06:49:36 UTC
any better with the 2.6.9 update ?

Comment 6 John William 2004-12-12 16:55:46 UTC
The test machine has been switched to FC3, with:


and the problem seems to be somewhat fixed. I can no longer get 
corruption on the FAT32 volume by copying directories with UTF8 
names, but mkdir calls fail with "Invalid argument" when trying to 
create a directory with extended characters in the name. This 
means "cp -r ~/dir1 ~/dir2" will fail on any (sub)directories with 
extended characters in the name.

If I mount the FAT32 volume with "-o utf8" the problem seems to 

Comment 7 Dave Jones 2005-04-16 04:34:55 UTC
Fedora Core 2 has now reached end of life, and no further updates will be
provided by Red Hat.  The Fedora legacy project will be producing further kernel
updates for security problems only.

If this bug has not been fixed in the latest Fedora Core 2 update kernel, please
try to reproduce it under Fedora Core 3, and reopen if necessary, changing the
product version accordingly.

Thank you.

Note You need to log in before you can comment on or make changes to this bug.