Linux online course

FAT File System in Linux

Learn how FAT12, FAT16, and FAT32 work, how Linux mounts FAT media, and when to choose FAT, exFAT, ext4, NTFS, or JFS.

FAT stands for File Allocation Table. It is a disk file system that records which storage clusters belong to each file. Although FAT is an older design, it remains important because USB drives, memory cards, cameras, game consoles, embedded devices, and firmware interfaces often support it.

This lesson explains the FAT family, how Linux reads and writes FAT volumes, how to mount and format removable media safely, and when FAT is or is not a good choice.

What FAT Is and Why It Exists

A file system organizes data on a storage device so an operating system can create, find, modify, and delete files. FAT divides a volume into groups of disk sectors called clusters. A cluster is the smallest group of sectors that FAT allocates to a file.

The file system maintains an allocation table containing entries for clusters. These entries indicate whether a cluster is free, contains the end of a file, or points to the next cluster belonging to that file. The table therefore acts as a map from a file to its data on the disk.

FAT is both the name of this allocation structure and the name of a family of related file systems. Its design is simple and widely implemented, but it does not provide many features expected from modern file systems.

Historical Background

Microsoft originally developed FAT. It became closely associated with DOS and early consumer releases of Windows, including Windows 9x and Windows ME. Its straightforward layout helped many different operating systems and devices implement support for the same media.

FAT predates modern Linux file systems such as ext4 and newer Windows-oriented designs such as NTFS. Its continuing importance is not primarily advanced performance or reliability. Instead, it is the result of broad compatibility across operating systems and dedicated devices.

FAT12, FAT16, and FAT32

The number in each traditional FAT name describes the approximate width of the allocation-table entries. More available entry values allow the file system to address more clusters, although practical volume limits also depend on cluster size and format-specific rules.

VariantTypical historical media or useRelative capacity supportCurrent relevance
FAT12Floppy disks and other very small mediaSmallest of the three variantsMainly historical, but useful for compatibility with old systems
FAT16Older small-to-medium disks and removable mediaLarger than FAT12, smaller than FAT32Still encountered on some legacy devices
FAT32USB drives, memory cards, and broadly compatible removable mediaLarger volumes and files than FAT12 or FAT16, subject to its limitsThe most relevant traditional FAT variant

FAT32 is the newest traditional FAT variant. It supports larger volumes than FAT12 and FAT16, but an individual FAT32 file cannot exceed approximately 4 GiB minus 1 byte. This limit applies even when the volume has plenty of free space.

exFAT is a separate Microsoft file system. It is related to the removable-media FAT family in purpose, but it is not the same as FAT32. exFAT is commonly selected when modern removable storage must hold files larger than the FAT32 limit.

How FAT Allocation Works

Imagine a volume divided into clusters numbered 100, 101, 102, and so on. A small file might occupy clusters 100, 101, and 102. The FAT entries form a chain such as:

file start: 100
FAT[100] = 101
FAT[101] = 102
FAT[102] = end of file

The directory entry stores information such as the file name, size, timestamps, attributes, and starting cluster. The allocation table then lets the operating system follow the chain to find the rest of the file.

Fragmentation occurs when a file's clusters are not adjacent. For example, a file might use clusters 100, 250, and 251 because clusters between them were already occupied. The FAT chain can still describe the file, but reading it may require accessing data from several areas of the volume. Repeated creation and deletion of files can make fragmentation more common.

Cluster size affects space usage and limits. Larger clusters can reduce the number of allocation entries needed for a large volume, but they waste more space when many small files are stored. The FAT entry width limits how many clusters can be represented, while the cluster size influences the total addressable volume size. File-size fields and the FAT32 format also impose independent limits.

Linux Support for FAT

Linux can normally read and write FAT12, FAT16, and FAT32 volumes. The Linux vfat driver and mount type are commonly used for FAT volumes, including support for long filenames. The name VFAT refers to FAT extensions associated especially with long filename support; it does not mean that the volume is a different traditional FAT capacity class.

Desktop environments often detect removable media and mount it automatically when it is connected. A file manager may then display the volume under a location such as /media/username/label. On a server, a minimal installation, or a scripted workflow, you can mount the volume manually.

Identify a FAT device

First list block devices, partitions, file system types, labels, UUIDs, and current mount points:

lsblk -f

You can also display detected file system and UUID information with:

sudo blkid

Look for a type such as vfat. Do not assume that /dev/sdX1 is the correct device: replace it only after identifying the actual removable partition. Device names can change when hardware is connected or disconnected.

Manually mount a FAT32 partition

Create a directory to serve as the mount point:

sudo mkdir -p /mnt/fat-usb

Then mount the known FAT partition using the vfat type:

sudo mount -t vfat /dev/sdX1 /mnt/fat-usb

After mounting, the files on the volume are accessible below /mnt/fat-usb. The mount operation makes the file system available at that directory in Linux's directory tree.

Unmount before disconnecting

Always unmount removable media before physically removing it:

sudo umount /mnt/fat-usb

Unmounting flushes buffered writes and releases the file system. A desktop environment may provide a safely-eject action that performs the equivalent operation.

Ownership, Permissions, and Mount Options

FAT does not store native Unix owners, groups, permission bits, or symbolic links on the volume. Linux therefore presents ownership and permissions using mount-time settings rather than reading them from FAT metadata.

For example, this command assigns files to the current user's numeric user and group IDs and applies a permission mask:

sudo mount -t vfat -o uid=$(id -u),gid=$(id -g),umask=022 /dev/sdX1 /mnt/fat-usb
OptionPurposeExample value or effect
uidSets the apparent owner user IDuid=1000 or the current user's ID
gidSets the apparent owner group IDgid=1000
umaskRemoves permission bits from files and directoriesumask=022 commonly permits owner writing and broader reading
fmaskRemoves permission bits from filesfmask=133 can prevent group and other file writing
dmaskRemoves permission bits from directoriesdmask=022 commonly permits directory access and owner writing
roMounts read-onlyUseful when protecting data during inspection
rwRequests read-write accessMay still fail if the device or kernel marks it read-only
utf8Controls UTF-8 handling for filenamesUseful for filename compatibility where supported by the system

For a persistent mount, use a UUID rather than a changing device name in /etc/fstab:

UUID=YOUR-UUID /mnt/fat-usb vfat defaults,uid=1000,gid=1000,umask=022,nofail 0 0

Replace YOUR-UUID with the value reported by blkid. Check the device and mount point carefully before editing /etc/fstab.

Why FAT Remains Widely Compatible

FAT's main continuing advantage is that many unrelated systems know how to read it. Linux and Windows support it, and it is also recognized by digital cameras, game consoles, televisions, car systems, embedded devices, firmware interfaces, and other portable electronics.

This compatibility is especially useful for removable storage that moves between computers and specialized devices. A Linux-native file system might preserve more metadata, but a camera or firmware updater may not understand it. FAT can therefore be preferable when the most important requirement is that the media work in as many devices as possible.

Typical Uses

  • Floppy disks: FAT12 was commonly used on historically small removable media.
  • USB flash drives: FAT32 is often chosen for broad computer and device compatibility.
  • Memory cards: Cameras and portable electronics frequently support FAT-based formats.
  • Portable electronics: Printers, media players, game consoles, and embedded systems may expect FAT.
  • Boot and firmware media: Some firmware interfaces and update tools require or prefer a FAT-readable partition.

Limitations Compared with Modern File Systems

  • No native Unix ownership and permissions: FAT cannot preserve the normal Linux user, group, mode, and ownership metadata of each file.
  • No journaling: Journaling records pending file system changes so recovery after a crash can be more predictable. Traditional FAT does not provide this feature.
  • Greater risk after unsafe removal: Unexpected unplugging or power loss can leave buffered data unwritten or make the allocation table inconsistent.
  • Metadata differences: FAT timestamps, attributes, filename behavior, and other metadata do not match all Linux file system semantics. Symbolic links and executable-bit behavior are not represented as native FAT features.
  • FAT32 file-size limit: A single file is limited to approximately 4 GiB minus 1 byte.
  • Scalability and performance limits: Large or heavily used volumes can suffer from allocation-table overhead and fragmentation, and FAT lacks many features designed for robust, high-scale workloads.

These limitations do not make FAT unusable. They mean that FAT is best treated as a compatibility format, not usually as the preferred file system for a Linux system disk or a high-value continuously changing data volume.

FAT Compared with Common Alternatives

FilesystemCross-platform compatibilityLarge-file supportLinux permissionsJournalingBest use case
FAT32Very broad, including many embedded devicesNo individual file at or above approximately 4 GiBNo native Unix permissionsNoSmall or moderate removable media where maximum compatibility matters
exFATBroad on modern operating systems and devices, but not universal on older equipmentSupports files larger than FAT32 allowsNo native Unix permissionsNo traditional FAT-style journalingModern removable storage containing large files
ext4Excellent on Linux, limited on many non-Linux devices without extra supportLarge files and volumesYesYesLinux system disks and Linux-only data storage
NTFSStrong Windows support and usable Linux support; device support variesLarge files and volumesSupports Linux-side permission mapping, but does not provide native Linux semantics when shared like ext4YesStorage shared primarily with Windows or requiring NTFS features
JFSPrimarily Linux and other Unix-like environmentsLarge files and volumesYesYesSpecialized Linux or Unix-like workloads where JFS is selected

Choosing FAT or Another File System

  • Choose FAT32 when the drive must work with the widest range of computers and devices and no individual file exceeds its limit.
  • Choose exFAT for modern removable storage when large files are required and all target devices support exFAT.
  • Choose ext4 for a Linux-only disk when Unix permissions, journaling, and robust Linux behavior matter more than compatibility with cameras or consoles.
  • Choose NTFS when Windows compatibility and large files are important, provided the target devices support NTFS.
  • Choose JFS only when its characteristics and platform support match the workload.

The decision depends on device compatibility, file sizes, reliability requirements, metadata needs, and the operating systems involved. There is no single best file system for every removable drive.

Formatting a Partition as FAT32

The mkfs.fat utility creates a FAT file system. The following command requests FAT32:

sudo mkfs.fat -F 32 /dev/sdX1

Troubleshooting FAT on Linux

The drive mounts but files cannot be created

Inspect the current mount options and determine whether the volume is read-only. It may have been mounted with restrictive ownership or masks, the kernel may have switched it to read-only after detecting an error, or the device may have a physical write-protection switch. Remount it with suitable uid, gid, and mask settings after checking the data is safe to modify. Kernel messages can help identify hardware or file system errors.

A file larger than 4 GiB will not copy

This is the FAT32 individual-file limit, not necessarily a shortage of free space. Use exFAT, NTFS, ext4, or another suitable file system if every target device supports it. Splitting the file is an alternative when changing the file system is impossible.

Linux reports an unknown file system type

Verify the partition type with lsblk -f or sudo blkid. The partition may not be FAT-formatted, the file system may be damaged, or required driver and userspace support may be unavailable. Check system logs for details. Use an appropriate repair tool only after confirming the device and considering a backup.

Data disappears after unplugging

Buffered writes may not have completed before removal. Traditional FAT has no journaling and is more vulnerable to unsafe removal. Unmount or safely eject the volume before disconnecting it. If corruption has occurred, run a suitable file system check after confirming the device and recover from backups when necessary.

Unix metadata is not preserved

FAT does not store standard Linux executable bits, owners, groups, symbolic links, and complete Unix metadata. Mount options can emulate access permissions for a mounted user, but they cannot turn FAT into a Linux-native metadata store. Use ext4 or another Linux-native file system when those properties must be preserved, or place the files in an archive format that records the required metadata.

Summary

  • FAT means File Allocation Table and describes both an allocation structure and a family of file systems.
  • FAT12, FAT16, and FAT32 differ mainly in allocation-entry width, supported cluster counts, and practical capacity limits.
  • Linux commonly mounts FAT12, FAT16, and FAT32 volumes through the vfat driver and mount type.
  • FAT's greatest strength is compatibility with many operating systems and devices.
  • FAT32 cannot store an individual file of approximately 4 GiB or larger.
  • FAT lacks native Unix permissions and journaling, so it is less suitable for Linux system storage and vulnerable to unsafe removal.
  • Use exFAT for many modern large-file removable-media scenarios, and ext4 or another native file system when Linux features are the priority.

For broader Linux file system concepts, see Linux. The command Determine File Type can also help when identifying the kind of data or file involved in a storage workflow.