Linux Filesystem Types: ext4 vs xfs vs btrfs

Linux Filesystem Types: ext4 vs xfs vs btrfs

What Is a Filesystem, and Which One Should You Choose?

Conclusion: When in doubt, pick ext4 (mature and stable). Choose xfs for large, highly parallel I/O, and btrfs when you want snapshots and checksums.

A filesystem maps the raw blocks on a disk into a structure of files and directories, and manages metadata such as permissions, timestamps, and sizes. On Linux, the same physical disk behaves differently depending on which filesystem you format it with — performance, operational features, and resize flexibility all change.

This guide compares the three filesystems most common on modern Linux — ext4, xfs, and btrfs — using practical decision criteria.

Three-line summary

  • ext4: The mature, stable default. A safe choice for desktops and general servers.
  • xfs: Strong at large volumes and parallel I/O. The default on RHEL-family distros. Grows online but cannot shrink.
  • btrfs: Feature-rich, with CoW, snapshots, checksums, and built-in RAID.

Assumptions

  • Scope is local Linux filesystems (network filesystems and FAT/exFAT are out of scope).
  • Formatting (mkfs) erases all data on the target. In production, always confirm backups and the exact device name first.

What Is ext4, and When Should You Use It?

Conclusion: ext4 is the most battle-tested general-purpose filesystem. Journaling and extents give it crash resilience and good throughput, making it a safe default.

ext4 (fourth extended filesystem) continues the ext2/ext3 lineage and has long been the default on Debian, Ubuntu, and others. Its biggest strength is maturity: it has by far the most production track record, and its failure modes and fixes are widely documented.

Key features:

  • Journaling: Writes are recorded to a journal first, so after a power loss fsck can restore consistency quickly.
  • Extents: Contiguous blocks are tracked as ranges (start + length), reducing fragmentation and handling large files efficiently.
  • Online grow: You can grow it while mounted with resize2fs; shrinking requires unmounting.
# Format as ext4 (always double-check the target device)
$ sudo mkfs.ext4 /dev/sdX1

# Grow while mounted (after extending the LV or partition)
$ sudo resize2fs /dev/sdX1

Use ext4 when

  • You have no specific reason to choose otherwise (desktop / small-to-medium server).
  • You prioritize stability and the largest pool of troubleshooting knowledge.

What Is xfs, and When Should You Use It?

Conclusion: xfs is a 64-bit filesystem optimized for large volumes and high parallel I/O. The key operational caveat: it can grow online but cannot shrink.

xfs was originally developed by SGI for IRIX and is now the default filesystem on RHEL, CentOS Stream, Rocky, and AlmaLinux. It excels at large files, heavy metadata operations, and parallel I/O.

Key features:

  • Allocation groups: The volume is split into independent regions whose metadata can be updated in parallel, boosting throughput.
  • Built for scale: A 64-bit design that scales to exabyte-class volumes, well suited to file servers and large storage.
  • Online grow only: xfs_growfs grows it while mounted, but there is no shrink feature.
# Format as xfs
$ sudo mkfs.xfs /dev/sdX1

# Grow online by mount point
$ sudo xfs_growfs /mnt/data

Design around the no-shrink rule

xfs cannot reduce capacity after the fact. Plan partition and LVM sizes in the "grow later" direction; if you may need to shrink, consider ext4 or btrfs instead.

Use xfs when

  • You run large volumes (multiple TB) or file servers.
  • You want to match the RHEL-family default and its operational knowledge.

What Is btrfs, and When Should You Use It?

Conclusion: btrfs is feature-rich, with CoW, snapshots, checksums, and subvolumes. It is compelling for data protection and rollback, but operating it is more complex than ext4 or xfs.

btrfs (B-tree filesystem) is a next-generation filesystem built on Copy-on-Write (CoW), used as the default on openSUSE and the Fedora desktop. It pulls volume-management features into the filesystem itself rather than being a plain store.

Key features:

  • Copy-on-Write (CoW): Instead of overwriting existing data, it writes to a new location. This pairs well with snapshots and makes old data less likely to be corrupted by a crash mid-write.
  • Snapshots: Capture a point-in-time state instantly and roll back a failed change — handy as a safety net before updates.
  • Checksums: Both data and metadata are checksummed, so silent bit rot can be detected.
  • Subvolumes / built-in RAID: Partition one filesystem logically and span multiple devices.
  • Online grow and shrink: btrfs filesystem resize changes size in either direction while mounted.
# Format as btrfs
$ sudo mkfs.btrfs /dev/sdX1

# Example snapshot (snapshot of / into /snap)
$ sudo btrfs subvolume snapshot / /snap/root-backup

Power comes with operational cost

CoW tends to fragment, and on heavy-overwrite workloads such as databases or VM disk images, performance can drop (some setups disable CoW for those paths). The learning curve to use its features well is also higher than ext4/xfs.

Use btrfs when

  • You want to roll back before/after updates with snapshots (e.g. snapper on openSUSE).
  • You want checksums to detect corruption, or to combine multiple devices into one.

How Do You Compare and Choose Among ext4 / xfs / btrfs?

Conclusion: The base axes are "stability → ext4", "large/parallel → xfs", and "snapshots/data protection → btrfs". Shrink support and feature count are the main trade-offs.

Aspect ext4 xfs btrfs
Maturity Very high High Evolving (feature-rich)
Sweet spot General / stable Large / parallel I/O Data protection / flexible
Journaling Yes Yes CoW (different model)
Snapshots No (needs LVM) No (needs LVM) Native
Checksums Metadata only Metadata-focused Data + metadata
Online grow Yes Yes (xfs_growfs) Yes
Online shrink No (needs umount) No Yes
Common default distro Debian/Ubuntu RHEL family openSUSE / Fedora (partial)

Quick picker

  • No strong reason → ext4
  • Large file server / RHEL family → xfs
  • Want snapshot rollback / corruption detection → btrfs

How Do You Check Your System's Filesystem?

Conclusion: df -T shows usage with the type, lsblk -f shows the FS per device, and blkid shows UUID and TYPE. Use them to confirm the device before formatting too.

# List mounted filesystems including the Type column
$ df -T
Filesystem     Type     1K-blocks      Used Available Use% Mounted on
/dev/sda2      ext4      48000000  20000000  25600000  44% /
/dev/sda1      vfat        523248      6132    517116   2% /boot/efi
# Show FS type, UUID, and mount point per block device
$ lsblk -f

# Show TYPE / UUID for a single device (avoid picking the wrong one before mkfs)
$ blkid /dev/sdX1

To quickly learn just the root filesystem type, either works:

$ findmnt -no FSTYPE /
$ stat -f -c %T /

Before running mkfs.* or wipefs, always double-check with lsblk / blkid that the target device name is correct. A one-character mistake that wipes the wrong disk is a depressingly common accident.

Summary - ext4 by Default, xfs / btrfs by Requirement

Choosing a filesystem is less about finding "the one best" and more about matching requirements.

  • ext4: The mature, stable default. Pick it when unsure.
  • xfs: Large volumes, parallel I/O, RHEL-family standard — but no shrink.
  • btrfs: Feature-rich with CoW, snapshots, and checksums — slightly more complex to operate.

Start by running df -T and lsblk -f to see which filesystem you are using right now.