Home Blog Certs Knowledge Base About

Filesystem Types

Linux filesystem comparison: ext4 (universal default), XFS (high throughput), Btrfs (snapshots + compression), ZFS (enterprise reliability). Formatting, tuning, and repair commands.

ext4

ext4 โ€” Extended Filesystem 4
PropertyValue
Max file size16 TB
Max volume size1 EB
JournalingYes โ€” data, ordered (default), writeback modes
SnapshotsNo โ€” use LVM snapshots externally
Online shrinkNo โ€” must unmount to shrink
Online growYes (resize2fs while mounted)
Default onDebian, Ubuntu, and most general-purpose distros
Best forGeneral purpose, VMs, boot partitions, broad compatibility
ext4 commands
CommandDescription
mkfs.ext4 /dev/sdb1Format with ext4
mkfs.ext4 -L mydata /dev/sdb1Format with label
mkfs.ext4 -b 4096 -j /dev/sdb1Specify block size (4096 = default)
tune2fs -l /dev/sdb1Show superblock (UUID, features, mount count)
tune2fs -L newlabel /dev/sdb1Set filesystem label
tune2fs -c 30 /dev/sdb1Force fsck every 30 mounts
tune2fs -i 6m /dev/sdb1Force fsck every 6 months
tune2fs -e remount-ro /dev/sdb1Remount read-only on error (safe default)
e2fsck -f /dev/sdb1Force check (must be unmounted)
e2fsck -p /dev/sdb1Auto-repair without interactive prompts
resize2fs /dev/data-vg/lvGrow to fill LV (online)
resize2fs /dev/sdb1 30GShrink to 30 GB (unmounted)
dumpe2fs /dev/sdb1Full superblock + group descriptor dump
debugfs /dev/sdb1Interactive ext2/3/4 debugger (recover deleted files)

XFS

XFS properties
PropertyValue
Max file size8 EB
Max volume size8 EB
JournalingYes โ€” metadata only by default (fast)
Online shrinkNo โ€” cannot shrink XFS
Online growYes (xfs_growfs while mounted)
Delayed allocationYes โ€” batches writes for efficiency
Default onRHEL, CentOS, AlmaLinux, Rocky Linux
Best forLarge files, databases, high-throughput I/O, media storage
XFS commands
CommandDescription
mkfs.xfs /dev/sdb1Format with XFS
mkfs.xfs -L mydata /dev/sdb1Format with label
mkfs.xfs -f /dev/sdb1Force overwrite existing filesystem
xfs_info /mount/pointFilesystem info (block size, allocation groups)
xfs_growfs /mount/pointGrow to fill block device (must be mounted)
xfs_repair /dev/sdb1Repair XFS filesystem (must be unmounted)
xfs_repair -n /dev/sdb1Dry-run check, no changes
xfs_check /dev/sdb1Check consistency (older, xfs_repair preferred)
xfs_fsr /mount/pointDefragment XFS (online)
xfs_db -r /dev/sdb1Interactive debugger (read-only)
xfs_admin -l /dev/sdb1Show label
xfs_admin -L newlabel /dev/sdb1Set label (unmounted)
xfs_quota -x -c 'report -h' /mountShow quota report

Btrfs

Btrfs โ€” B-tree Filesystem properties
PropertyValue
Max file size16 EB
Max volume size16 EB
SnapshotsYes โ€” native, instant, space-efficient (Copy-on-Write)
Built-in RAIDRAID 0, 1, 10, 5, 6 (RAID 5/6 still experimental)
Compressionzlib, lzo, zstd โ€” transparent, per-file or per-mount
ChecksumsCRC32C per block โ€” detects silent data corruption
Online shrinkYes
SubvolumesIndependent filesystem trees within the same volume
Default onopenSUSE, Fedora (since F33), SteamOS
Best forDesktop Linux, NAS, systems needing snapshots and compression
Btrfs commands
CommandDescription
mkfs.btrfs /dev/sdb1Format with Btrfs
mkfs.btrfs -L mydata /dev/sdb1Format with label
mkfs.btrfs -d raid1 -m raid1 /dev/sdb /dev/sdcRAID 1 across two drives
btrfs filesystem show /mountFilesystem info
btrfs filesystem df /mountSpace usage by type (data, metadata)
btrfs filesystem resize max /mountGrow to fill block device (online)
btrfs filesystem resize -10G /mountShrink by 10 GB (online)
btrfs subvolume create /mount/volCreate a subvolume
btrfs subvolume list /mountList all subvolumes
btrfs subvolume snapshot /mount/vol /mount/vol_snapCreate read-write snapshot
btrfs subvolume snapshot -r /mount/vol /mount/vol_snapCreate read-only snapshot
btrfs subvolume delete /mount/vol_snapDelete snapshot
btrfs scrub start /mountVerify all block checksums (background)
btrfs scrub status /mountCheck scrub progress
btrfs balance start /mountRebalance data across drives
btrfs check /dev/sdb1Check consistency (unmounted)

Enable compression in fstab: compress=zstd or compress=zstd:3 (level 1โ€“22). Per-file: chattr +c file or btrfs property set file compression zstd.

ZFS (OpenZFS)

ZFS properties
PropertyValue
SnapshotsInstant, space-efficient, unlimited
RAIDZRAIDZ1 (RAID 5 equiv), RAIDZ2 (RAID 6), RAIDZ3
Compressionlz4 (default), gzip, zstd โ€” per dataset
DeduplicationYes โ€” RAM-intensive (DDT table)
ChecksumsEnd-to-end, SHA256/Blake3 โ€” self-healing
ARC cacheAdaptive Replacement Cache โ€” in RAM
Default onFreeBSD, TrueNAS, Proxmox (optional)
Best forNAS, mission-critical data, storage servers
RAM minimum1 GB per 1 TB storage (ARC sizing rule of thumb)
ZFS commands
CommandDescription
apt install zfsutils-linuxInstall ZFS on Ubuntu/Debian
zpool create mypool /dev/sdb /dev/sdcCreate striped pool (RAID 0)
zpool create mypool mirror /dev/sdb /dev/sdcMirror pool (RAID 1)
zpool create mypool raidz /dev/sdb /dev/sdc /dev/sddRAIDZ1 pool (min 3 drives)
zpool statusPool health, degraded drives
zpool status -vVerbose โ€” shows error counts
zpool listPool size and usage
zpool scrub mypoolVerify all checksums (runs in background)
zfs listAll datasets and their sizes
zfs create mypool/dataCreate a dataset
zfs set compression=lz4 mypool/dataEnable compression on dataset
zfs set quota=100G mypool/dataSet quota on dataset
zfs snapshot mypool/data@snap1Create a snapshot
zfs list -t snapshotList all snapshots
zfs rollback mypool/data@snap1Roll dataset back to snapshot
zfs clone mypool/data@snap1 mypool/cloneWritable clone from snapshot
zfs send mypool/data@snap1 | ssh host zfs receive pool/dataReplicate dataset to remote host
zfs destroy mypool/data@snap1Delete a snapshot

Comparison

Feature matrix
Featureext4XFSBtrfsZFS
SnapshotsNoNoYes (CoW)Yes (CoW)
Built-in RAIDNoNoYesYes (RAIDZ)
CompressionNoNoYesYes
ChecksumsNoNoYesYes (e2e)
DeduplicationNoNoLimitedYes
Online shrinkNoNoYesNo
Online growYesYesYesYes
SubvolumesNoNoYesYes (datasets)
Maturity / stabilityโ˜…โ˜…โ˜…โ˜…โ˜…โ˜…โ˜…โ˜…โ˜…โ˜…โ˜…โ˜…โ˜…โ˜…โ˜†โ˜…โ˜…โ˜…โ˜…โ˜…
RAM overheadVery lowVery lowLowHigh (ARC)
Linux kernelMainlineMainlineMainlineDKMS module
Default distroUbuntu/DebianRHEL/FedoraopenSUSE/FedoraFreeBSD/TrueNAS
When to choose
Use caseRecommended FSReason
Boot partitionext4Maximum compatibility with bootloaders
General serverext4 or XFSProven, simple, no surprises
Database (MySQL, Postgres)XFS or ext4Consistent write performance, no CoW overhead
Large files (video, backups)XFSExcellent at sequential I/O and large extents
Desktop with snapshotsBtrfsNative snapshots before upgrades, compression
NAS with data integrityZFSEnd-to-end checksums, self-healing, RAIDZ
Container hostBtrfs or ZFSEfficient layer snapshots (Docker, LXC)
Limited RAM serverext4 or XFSZFS/Btrfs need more RAM for metadata

Common utilities

Universal filesystem tools
CommandDescription
blkidShow UUID, type, and label of all block devices
lsblk -fBlock device tree with filesystem info
file -s /dev/sdb1Detect filesystem type on a raw device
fsck /dev/sdb1Check and repair filesystem (generic wrapper)
fdisk -lPartition table and sizes
parted /dev/sdb printPartition info (GPT-aware)
lsblk -o NAME,SIZE,FSTYPE,MOUNTPOINT,UUIDCustom lsblk columns