Linux файловая система vfat

What is the difference between VFAT and FAT32 file systems?

I have searched the internet, but could not find any convincing answers; Are the filesystems VFAT and FAT32 the same, or are there any differences between them?

2 Answers 2

What’s FAT?

FAT may sound like a strange name for a file system, but it’s actually an acronym for File Allocation Table. Introduced in 1981, FAT is ancient in computer terms. Because of its age, most operating systems, including Microsoft Windows NT®, Windows 98, the Macintosh OS, and some versions of UNIX, offer support for FAT.

The FAT file system limits filenames to the 8.3 naming convention, meaning that a filename can have no more than eight characters before the period and no more than three after. Filenames in a FAT file system must also begin with a letter or number, and they can’t contain spaces. Filenames aren’t case sensitive.

What About VFAT?

Perhaps you’ve also heard of a file system called VFAT. VFAT is an extension of the FAT file system and was introduced with Windows 95. VFAT maintains backward compatibility with FAT but relaxes the rules. For example, VFAT filenames can contain up to 255 characters, spaces, and multiple periods. Although VFAT preserves the case of filenames, it’s not considered case sensitive.

When you create a long filename (longer than 8.3) with VFAT, the file system actually creates two different filenames. One is the actual long filename. This name is visible to Windows 95, Windows 98, and Windows NT (4.0 and later). The second filename is called an MS-DOS® alias. An MS-DOS alias is an abbreviated form of the long filename. The file system creates the MS-DOS alias by taking the first six characters of the long filename (not counting spaces), followed by the tilde [~] and a numeric trailer. For example, the filename Brien’s Document.txt would have an alias of BRIEN’~1.txt.

An interesting side effect results from the way VFAT stores its long filenames. When you create a long filename with VFAT, it uses one directory entry for the MS-DOS alias and another entry for every 13 characters of the long filename. In theory, a single long filename could occupy up to 21 directory entries. The root directory has a limit of 512 files, but if you were to use the maximum length long filenames in the root directory, you could cut this limit to a mere 24 files. Therefore, you should use long filenames very sparingly in the root directory. Other directories aren’t affected by this limit.

Читайте также:  Set alias in linux

You may be wondering why we’re discussing VFAT. The reason is it’s becoming more common than FAT, but aside from the differences I mentioned above, VFAT has the same limitations. When you tell Windows NT to format a partition as FAT, it actually formats the partition as VFAT. The only time you’ll have a true FAT partition under Windows NT 4.0 is when you use another operating system, such as MS-DOS, to format the partition.

FAT32

FAT32 is actually an extension of FAT and VFAT, first introduced with Windows 95 OEM Service Release 2 (OSR2). FAT32 greatly enhances the VFAT file system but it does have its drawbacks.

The greatest advantage to FAT32 is that it dramatically increases the amount of free hard disk space. To illustrate this point, consider that a FAT partition (also known as a FAT16 partition) allows only a certain number of clusters per partition. Therefore, as your partition size increases, the cluster size must also increase. For example, a 512-MB FAT partition has a cluster size of 8K, while a 2-GB partition has a cluster size of 32K.

This may not sound like a big deal until you consider that the FAT file system only works in single cluster increments. For example, on a 2-GB partition, a 1-byte file will occupy the entire cluster, thereby consuming 32K, or roughly 32,000 times the amount of space that the file should consume. This rule applies to every file on your hard disk, so you can see how much space can be wasted.

Converting a partition to FAT32 reduces the cluster size (and overcomes the 2-GB partition size limit). For partitions 8 GB and smaller, the cluster size is reduced to a mere 4K. As you can imagine, it’s not uncommon to gain back hundreds of megabytes by converting a partition to FAT32, especially if the partition contains a lot of small files.

Note: This section of the quote/ article (1999) is out of date. Updated info quote below.

As I mentioned, FAT32 does have limitations. Unfortunately, it isn’t compatible with any operating system other than Windows 98 and the OSR2 version of Windows 95. However, Windows 2000 will be able to read FAT32 partitions.

The other disadvantage is that your disk utilities and antivirus software must be FAT32-aware. Otherwise, they could interpret the new file structure as an error and try to correct it, thus destroying data in the process.

Finally, I should mention that converting to FAT32 is a one-way process. Once you’ve converted to FAT32, you can’t convert the partition back to FAT16. Therefore, before converting to FAT32, you need to consider whether the computer will ever be used in a dual-boot environment. I should also point out that although other operating systems such as Windows NT can’t directly read a FAT32 partition, they can read it across the network. Therefore, it’s no problem to share information stored on a FAT32 partition with other computers on a network that run older operating systems.

Читайте также:  Pvr iptv simple client linux

Updated mentioned in comment by Doktor-J (assimilated to update out of date answer in case comment is ever lost):

I’d just like to point out that most modern operating systems (WinXP/Vista/7/8, MacOS X, most if not all Linux variants) can read FAT32, contrary to what the second-to-last paragraph suggests.

The original article was written in 1999, and being posted on a Microsoft website, probably wasn’t concerned with non-Microsoft operating systems anyways.

The operating systems «excluded» by that paragraph are probably the original Windows 95, Windows NT 4.0, Windows 3.1, DOS, etc.

Источник

Linux файловая система vfat

This article or section needs expansion.

File Allocation Table (FAT) is a computer file system architecture and a family of industry-standard file systems utilizing it. The FAT file system is a legacy file system which is simple and robust. It offers good performance even in light-weight implementations, but cannot deliver the same performance, reliability and scalability as some modern file systems. It is, however, supported for compatibility reasons by nearly all currently developed operating systems for personal computers and many mobile devices and embedded systems, and thus is a well-suited format for data exchange between computers and devices of almost any type and age from 1981 up to the present.

File system creation

To create a FAT filesystem, install dosfstools .

mkfs.fat supports creating FAT12, FAT16 and FAT32, see Wikipedia:File Allocation Table#Types for an explanation on their differences. mkfs.fat will select the FAT type based on the partition size, to explicitly create a certain type of FAT filesystem use the -F option. See mkfs.fat(8) for more information.

Tip: For most situations you will want to use FAT32. To ensure the partition can be formatted to FAT32, it should be at least 36 MiB on drives with 512 byte logical sector size and 260 MiB on drives with 4096 logical sector size.[1]

Читайте также:  Меняется время windows linux

Format a partition to FAT32:

# mkfs.fat -F 32 /dev/partition 

Kernel configuration

Here is an example of the default mount configuration in the kernel:

$ zgrep -e FAT -e DOS /proc/config.gz | sort -r
# DOS/FAT/NT Filesystems CONFIG_FAT_FS=m CONFIG_MSDOS_PARTITION=y CONFIG_FAT_FS=m CONFIG_MSDOS_FS=m CONFIG_VFAT_FS=m CONFIG_FAT_DEFAULT_CODEPAGE=437 CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" CONFIG_NCPFS_SMALLDOS=y

A short description of the options:

  • Language settings: CONFIG_FAT_DEFAULT_CODEPAGE , CONFIG_FAT_DEFAULT_IOCHARSET
  • All filenames to lower letters on a FAT partitions if enabled: CONFIG_NCPFS_SMALLDOS
  • Enables support of the FAT file systems: CONFIG_FAT_FS , CONFIG_MSDOS_FS , CONFIG_VFAT_FS
  • Enables support of a FAT partitioned harddisks on x86 PCs: CONFIG_MSDOS_PARTITION

If the partition type detected by mount is VFAT then it will run the /usr/bin/mount.vfat script.

#!/bin/bash #mount VFAT with full rw (read-write) permissions for all users #/usr/bin/mount -i -t vfat -oumask=0000,iocharset=utf8 "$@" #The above is the same as mount -i -t vfat -oiocharset=utf8,fmask=0000,dmask=0000 "$@"

Writing to FAT32 as normal user

To write on a FAT32 partition, you must make a few changes to the fstab file.

/dev/sdxY /mnt/some_folder vfat user,rw

The user option means that any user (even non-root) can mount and unmount the partition /dev/sdxY . rw gives read-write access.

For example, if your FAT32 partition is on /dev/sda9 , and you wish to mount it to /mnt/fat32 , then you would use:

/dev/sda9 /mnt/fat32 vfat user,rw

Now, any user can mount it with:

Note that FAT does not support Linux file permissions. Each file will also appear to be executable. You may want to use the showexec option to only mark Windows executables (com, exe, bat) as executable. See mount(8) for more options.

Detecting FAT type

If you need to know which type of FAT file system a partition uses, use the file command:

/dev/partition: DOS/MBR boot sector, code offset 0x3c+2, OEM-ID "mkfs.fat", sectors/cluster 4, root entries 512, sectors 4096 (volumes FAT (12 bit)

Alternatively you can use minfo from the mtools package:

# minfo -i /dev/partition ::
device information: =================== filename sectors per track: 32 heads: 64 cylinders: 2 media byte: f8 mformat command line: mformat -t 2 -h 64 -s 32 -i "/dev/partition" :: bootsector information ====================== banner:"mkfs.fat" sector size: 512 bytes cluster size: 4 sectors reserved (boot) sectors: 1 fats: 2 max available root directory slots: 512 small size: 4096 sectors media descriptor byte: 0xf8 sectors per fat: 3 sectors per track: 32 heads: 64 hidden sectors: 0 big size: 0 sectors physical drive id: 0x80 reserved=0x0 dos4=0x29 serial number: 5BC09C21 disk label="NO NAME " disk type

See also

Источник

Оцените статью
Adblock
detector