VFAT

From LQWiki
Jump to: navigation, search

VFAT is a updated version of the FAT filesystem for Windows. VFAT's updates are mainly support for longer file names, better performance, and better disk management.

Comparison

VFAT is commonly used on small devices, like floppies, or temporary drives, like a flash memory drive. Its main use is being fully supported by Linux, and Windows, making it important as a in-between for people that dual boot both Windows and Linux. Its limitations when compared to ext3 and ntfs include that you cannot store a file that is bigger than 2GB.

Difference to msdos

The difference between the msdos and vfat file system is that vfat can hold long file names. In the follwing example, the partition /dev/mmcblk0p1 is first mounted as vfat, then as msdos. Note that the file name length differs:

Nokia-N810-23-14:/home/user# mount
...
/dev/mmcblk1p1 on /media/card type msdos (rw,fmask=0000,dmask=0000,codepage=cp437)
/dev/mmcblk0p1 on /media/mmc2 type vfat (rw,fmask=0000,dmask=0000,codepage=cp437,iocharset=iso8859-1)
Nokia-N810-23-14:/home/user# ls /media/mmc2 | head
karm
kdelibs5_4.1.62~svn862211-0maemo1_armel.deb
libQt3Support.so.4
Nokia-N810-23-14:/home/user# umount /media/mmc2

Now we mount the same partition as msdos.

Nokia-N810-23-14:/home/user# mount /dev/mmcblk0p1 /media/mmc2
Nokia-N810-23-14:/home/user# mount
...
/dev/mmcblk0p1 on /media/mmc2 type msdos (rw,fmask=0022,dmask=0022,codepage=cp437)
Nokia-N810-23-14:/home/user# ls /media/mmc2
ab~1.b        libkab~1.4    libkim~1.4    libkpt~1.4    libsol~1.4
apt-ar~1      libkca~1.4    libkio~1.5    libkre~1.4    libstr~1.0
backups       libkca~2.4    libkld~1.4    libkut~1.4    libstr~2.0
karm          libkde~1.4    libkmi~1.4    libqt3~1.4    map

How to...

Mount a vfat partition

The problem is that if you do not tell the file system type, the partition will be mounted as msdos file system, so, issue the type like this:

Nokia-N810-23-14:/home/user# mount -t vfat /dev/mmcblk0p1 /media/mmc2

Verify it is mounted as vfat:

Nokia-N810-23-14:/home/user# mount
...
/dev/mmcblk0p1 on /media/mmc2 type vfat (rw,fmask=0022,dmask=0022,codepage=cp437,iocharset=iso8859-1)

Execute files on a vfat partition

To execute a file on a vfat partition, you need to have the file execution priviledges set. To do this, umount the partition and remount it like this:

Nokia-N810-23-14:/home/user# mount -o umask=000 -t vfat /dev/mmcblk0p1 /media/mmc2

Then your file permissions will be rwxrwxrwx:

Nokia-N810-23-14:/home/user# ls -l /media/mmc2
drwxrwxrwx    2 root     root         4096 Jan 31  2008 Video
-rwxrwxrwx    1 root     root            3 Jan 19 07:43 a.b.b
drwxrwxrwx    4 root     root         4096 Oct 10 21:34 backups
-rwxrwxrwx    1 root     root       169402 Jan 19 07:43 karm

Then you can execute files on this partition.

See also