When you add a disk, create a volume, or install a server, you choose a filesystem. On Linux servers, the main choices are ext4, XFS and Btrfs. All three are mature. The differences show up in resizing, very large files and filesystems, snapshots, and repair tools.

At a glance

ext4 XFS Btrfs
Default on Debian, Ubuntu RHEL, AlmaLinux, Rocky, CentOS Fedora Workstation, openSUSE
Grow online Yes Yes Yes
Shrink Yes (offline) No Yes (online)
Max file / volume size 16 TiB / 1 EiB 8 EiB / 8 EiB 16 EiB
Large files, parallel I/O Good Excellent Good
Many small files Very good Good Good
Snapshots, checksums, compression No No (reflinks only) Yes
Repair tool e2fsck (fsck.ext4) xfs_repair btrfs check (use with care)
Maturity for databases Excellent Excellent Good; disable CoW for DB files

ext4: the safe, flexible default

  • Extremely well tested, simple to manage, and can shrink as well as grow.
  • Great all-round performance for web servers, small databases, and mixed workloads.
  • The default on Debian and Ubuntu VPS images.

XFS: built for scale and parallel I/O

  • Excellent with large files, high concurrency, and big volumes (media, backups, large databases).
  • Default on RHEL-family systems.
  • Cannot be shrunk. Plan volume sizes carefully, especially with LVM. See extend an LVM volume.

Btrfs: features first

  • Snapshots, checksums for data integrity, transparent compression, subvolumes, send/receive.
  • Great for backup targets and systems where snapshots are valuable. See Btrfs snapshots.
  • Copy-on-write can fragment database and VM image files: use chattr +C on those directories.
  • Its RAID5/6 modes aren’t recommended for production.

Which to choose on a VPS?

Use Recommendation
General web/app server (system disk) Keep the image default (ext4 on Debian/Ubuntu, XFS on AlmaLinux/CentOS)
Extra data disk for MySQL/PostgreSQL ext4 or XFS: both excellent
Large media or backup storage XFS (or ext4)
Storage where you want snapshots and compression Btrfs
May need to shrink later ext4 or Btrfs (not XFS)

The filesystem choice matters less than the underlying storage, your I/O patterns, and keeping free space. See VPS storage planning.

Create and check

# create (destroys data on the target! double-check the device)
sudo mkfs.ext4 -L data /dev/vdb1
sudo mkfs.xfs  -L data /dev/vdb1

# inspect
lsblk -f
sudo tune2fs -l /dev/vdb1 | head         # ext4 details
sudo xfs_info /data                      # XFS details (mounted)

# grow after enlarging the partition/volume
sudo resize2fs /dev/vdb1                 # ext4
sudo xfs_growfs /data                    # XFS (by mount point)

Mount with entries in /etc/fstab using UUIDs. See fstab guide, mount options, and Linux device files.

Checking and repairing

  • ext4: sudo e2fsck -f /dev/vdb1 (unmounted). The system disk is checked at boot when needed.
  • XFS: sudo xfs_repair /dev/vdb1 (unmounted). XFS doesn’t need routine checks. Its journal replays automatically.
  • Always have backups before repairs. See backup strategy.

Quick reference

Need Pick
Safe default, can shrink ext4
Large files, high concurrency XFS
Snapshots, checksums, compression Btrfs
Grow ext4 / XFS resize2fs / xfs_growfs

Related: Linux filesystem journaling and LVM guide.

  • Linux
  • Storage
  • Filesystem