posted by Christian Paratschek on Thu 10th Feb 2005 20:14 UTC
IconRecently I stumbled across a very nice article, written by Torsten Scheck, published on pro-linux.de, a German Linux site. This article proved to be so helpful to me that I decided it would be worthwhile to translate it into English and republish it. Comments of the translator will be added in italics. I hope a lot of people will find this little gem as useful as I did...

The vfat file system has been supported by Linux for years now. Still there are a lot of obstacles. I want to show, with the help of some practical examples, these obstacles and possible solutions and workarounds.

Table of contents

1. Introduction
2. Replication of ext3 and vfat partitions via rsync
   2.1. Mounting Parameters
   2.2. Adjusting the system time
   2.3. File size limits
   2.4. Using rsync
3. Problems with large vfat file systems
   3.1. Lost clusters
   3.2. dosfsck and high RAM Demand
   3.3. Executing dosfsck
   3.4. Formatting a large vfat file system
4. Conclusion

1. Introduction

Many Linux users dislike the use of vfat. There are ample - and technically superior - alternatives for Linux users. Additionally, there's a judicial aspect: Microsoft's attempt to demand license fees due to a patent on a component of vfat leaves a bad after taste in many mouths.

Sadly, vfat is still the easiest way to share data between Linux and the somewhat limited Windows-world. With the soaring popularity of mobile data carriers, like CompactFlash-cards, USB-sticks and external Firewire (or USB2.0)-hard drives the significance of vfat as the least common denominator even rose.

The following article is based on experience that I collected working with two external 250GB hard drives (Maxtor 5000XT). While one of these discs held an ext3 partition and served as my primary data storage, the other one, holding a vfat partition, was used as backup drive and as the connection to the "Windows-world". I pretty much do the same thing: I have an external 60GB USB2.0-hard drive that holds an ext3 partition for everyday backup and a vfat partition, also for backup and to have my data easily available on any Windows machine.

I recently decided to merge my experiences into an article because I believe that enough Linux users will have the same problems that I had. So I hope that this article will save many hours of difficult problem analysis. Special thanks to Uwe Menges who helped me throughout my little vfat odyssey.

2. Replication of ext3 and vfat partitions via rsync

The characteristics of the vfat file system that are discussed in this section are of course not limited to the work with rsync. But rsync serves as a particularly good example to show a lot of possible challenges with vfat.

For those who don't know: rsync checks the date of the last change and file size to decide if a file that already exists on the destination folder has to be overwritten with the according file on the source folder. Using only Linux file systems, "rsync -av source/* destination" ensures that all files on the source are replicated identically on the destination. When running this command immediately again, no files should be transmitted.

To be able to use rsync between an ext3 and a vfat partition, there are some requirements to fulfill, and some of those are quite subtle.

2.1. Mounting Parameters

If you mount a vfat partition without any special parameters, a normal Linux user will not have write access. Also there will be a problem because vfat treates MS-DOS filenames (so called 8.3 filenames like FILENAME.EXT) differently:

	> mount /dev/sda1 /myvfat -t vfat
	> mount | grep sda1
	/dev/sda1 on /myvfat type vfat (rw)
	> grep sda1 /proc/mounts
	/dev/sda1 /myvfat vfat rw,nodiratime,fmask=0033,dmask=0033 0 0
	
	> cd /myvfat
	> touch ABCDEFGH
	> touch ABCDEFGHI
	> ls -l
	-rwxr--r--     1 root root     0 Dec 31 16:05 ABCDEFGHI
	-rwxr--r--     1 root root     0 Dec 31 16:05 abcdefgh
	
	Note the use of small letters - - - - - - - - - ^
Table of contents
  1. "VFat, Page 1/3"
  2. "VFat, Page 2/3"
  3. "VFat, Page 3/3"
e p (0)    26 Comment(s)

Technology White Papers

See More