Skip to content
linux storage

Filesystem

filesystem ext4 xfs ntfs storage linux
Plain English

A filesystem is the filing system for a disk. Raw storage is just billions of numbered blocks. The filesystem keeps track of which blocks belong to which file, what each file is called, which folder it is in, and who is allowed to open it. Formatting a drive means writing a new, empty filesystem onto it.

Technical Definition

A filesystem defines on-disk structures (superblock, inode tables, directories, allocation bitmaps, journal) and the kernel driver that reads and writes them.

Common filesystems:

FilesystemWhereNotes
ext4Linux default on Ubuntu, DebianJournaling, mature, fsck.ext4
XFSRHEL defaultLarge files, cannot shrink
BtrfsFedora, openSUSECopy-on-write, snapshots, checksums
ZFSProxmox, TrueNASPooled storage, checksums, snapshots, RAID-Z
vfat/FAT32EFI System Partition, USB sticksUniversal, 4 GB file limit
exFATLarge USB drives, SD cardsCross-platform
NTFSWindowsRead-write on Linux with the ntfs3 driver
APFSmacOSSnapshots, encryption

Journaling writes intended changes to a log before applying them, so a crash leaves the filesystem recoverable instead of corrupt.

The Linux view: everything appears in a single tree starting at /. Each filesystem is mounted at a directory. /etc/fstab lists what to mount at boot. Linux also has virtual filesystems with no disk behind them: /proc, /sys, tmpfs.

Source: Linux kernel documentation: Filesystems

Working with filesystems

# Filesystem type and usage for each mount
$ df -hT
Filesystem     Type  Size  Used Avail Use% Mounted on
/dev/sda2      ext4   24G  9.1G   14G  41% /
/dev/sda1      vfat  1.1G  6.2M  1.1G   1% /boot/efi

# Create one on a NEW empty partition and mount it
$ sudo mkfs.ext4 -L data /dev/sdb1
$ sudo mkdir -p /mnt/data && sudo mount /dev/sdb1 /mnt/data

# What is mounted where, as a tree
$ findmnt
In the Wild

Filesystem choice is a real decision on servers and NAS builds: ext4 for simple and reliable, XFS for large data on RHEL, ZFS when you want checksums, snapshots, and redundancy. Day to day, the filesystem problems you will see are full disks (df -h), running out of inodes (df -i), and a filesystem that needs fsck after a crash. Use exFAT for a USB drive that has to work on Windows, macOS, and Linux.