Skip to content

Linux Foundations / Understand the system underneath ยท Step 2 of 38

Lesson: Filesystem TypesSwitch
โ† Linux Foundations

System administration

Filesystem Types

See what a filesystem does, how common Linux types differ, and how to check which one you are using.

A disk on its own is just a long row of blocks. A filesystem is the structure that turns those blocks into files and directories, and records names, owners, permissions and where the data sits.

Linux supports many filesystem types, and one system can use several at once.

Journaling

If power fails in the middle of a write, a filesystem can be left half updated. A journaling filesystem first writes a note of the intended changes to a journal. After a crash it replays that journal, so it becomes consistent again quickly instead of scanning the whole disk.

A journal protects the structure of the filesystem. It does not replace backups, and recent data can still be lost.

Common Linux types

  • ext4 is the long-standing default on Debian, Ubuntu and many others. It is journaled and well understood.
  • XFS is journaled and handles large files well. It is the default on Red Hat Enterprise Linux. You can grow an XFS filesystem, but you cannot shrink it.
  • Btrfs uses copy-on-write and offers snapshots and checksums. Fedora Workstation and openSUSE use it by default for the root filesystem.

Types for sharing and memory

  • vfat (FAT32) is readable by almost every operating system. It does not store Linux ownership or permissions, and one file must be smaller than 4 GiB. The EFI system partition uses FAT.
  • exFAT is also portable and allows much larger files.
  • NTFS is the Windows filesystem. Linux can read and write it with the ntfs3 kernel driver or ntfs-3g.
  • tmpfs lives in memory (and may use swap). Its contents vanish at reboot.
  • NFS is a network filesystem: the files are on another machine.

Checking what you have

df -T adds a type column:

$ df -T /
Filesystem     Type 1K-blocks     Used Available Use% Mounted on
/dev/sda2      ext4  81987992 35235136  42542168  46% /

lsblk -f lists block devices with their filesystem, label and UUID:

$ lsblk -f /dev/sdb
NAME   FSTYPE FSVER LABEL UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
sdb
โ””โ”€sdb1 ext4   1.0   data  5ef4138f-5574-4227-8c74-58be9b62c010    8.9G     3% /srv/data

Older versions of lsblk show slightly different columns. To see which types the running kernel currently knows about, read /proc/filesystems. More can be loaded as modules.

Try it

Run df -T and lsblk -f on your machine. Find one filesystem stored on a disk and one that lives in memory. Then run cat /proc/filesystems and compare the list with what is actually mounted.

Check your understanding

Filesystem Types

All 5 sections ยท no timer

Unlimited retries

Questions from every section are combined into one assessment. Answer them all correctly to complete the article.

Your completion saves in this browser. Sign in to sync it to your account.