Why ext4 is still the default
ext4 is not the fastest filesystem (often XFS for large sequential writes), not the most feature-rich (Btrfs, ZFS), and not the newest design. It is the one distributions still ship for root volumes because it is simple, mature, and boring in the best way: journaling recovery, extents, and a well-understood failure model.
Evolution: ext2 → ext3 → ext4
- ext2 (1993) — basic layout, no journal; fast, risky on crash
- ext3 (2001) — journaling for crash recovery
- ext4 (2008) — extents, delayed allocation, larger files/volumes, better allocation
Journaling
Without a journal, an unclean shutdown can leave bitmaps and inodes half-updated. Recovery means a full fsck — minutes to hours on large volumes. ext4 writes planned metadata (and optionally data) to a journal first, then commits. On remount it replays incomplete transactions instead of walking the whole disk.
Journal modes
| Mode | What is journaled | Trade-off |
|---|---|---|
| journal | Data + metadata | Safest, slowest (write amplification) |
| ordered (default) | Metadata; data written first | Balanced safety and speed |
| writeback | Metadata only | Fastest; data may be stale after crash |
sudo tune2fs -o journal_data /dev/sda1 # Full data journaling
Extents and delayed allocation
ext3 tracked individual blocks — a 100 MB file could need tens of thousands of pointer entries. ext4 uses extents: (start_block, length) runs. Contiguous regions collapse to one record, which cuts metadata size, improves large-file I/O, and reduces fragmentation.
Delayed allocation waits until writeback to pick blocks, so the allocator sees larger, more contiguous requests instead of allocating on every write().
Limits (typical 4 KiB blocks)
- Max file ≈ 16 TiB
- Max volume ≈ 1 EiB
- Filename length 255 bytes
Block groups
ext4 partitions the volume into block groups — each with its own bitmaps, inode table, and data region. That enables parallel allocation, localizes damage, and keeps related files nearby on disk.
Each group roughly contains:
- Superblock — only in group 0, 1, and groups that are powers of 3, 5, or 7
- Group descriptors — free counts and bitmap locations for every group
- Block bitmap — free/used data blocks
- Inode bitmap — free/used inodes
- Inode table — fixed-size inode records
- Data blocks — file and directory contents
sudo dumpe2fs /dev/sda1 | head -50 sudo debugfs /dev/sda1 # debugfs: stats
Flex block groups
flex_bg packs metadata from several groups (often 16) so superblocks, bitmaps, and inode tables sit closer together — better sequential metadata I/O and larger contiguous free regions for data.
sudo dumpe2fs /dev/sda1 | grep -i flex # Flex block group size: 16
Creating and managing
# Basic sudo mkfs.ext4 /dev/sdb1 # Labeled, less reserved space, RAID stride, SSD discard sudo mkfs.ext4 -L "MyData" \ -m 1 \ -O extent,flex_bg \ -E stride=32,stripe-width=64,discard \ /dev/sdb1
Tuning
sudo tune2fs -l /dev/sdb1 sudo tune2fs -m 1 /dev/sdb1 # reserved blocks % sudo tune2fs -c 50 /dev/sdb1 # mount count before fsck sudo tune2fs -i 180 /dev/sdb1 # check interval (days) sudo tune2fs -L "BackupDrive" /dev/sdb1
Mount options
mount -o noatime,nodiratime /dev/sdb1 /mnt # skip atime updates mount -o discard /dev/sdb1 /mnt # TRIM (or fstrim) mount -o errors=remount-ro /dev/sdb1 /mnt
Performance and maintenance
tune2fs -O dir_index /dev/sdb1 # hashed directories tune2fs -J size=400 /dev/sdb1 # larger journal (DBs) sudo e2fsck -f /dev/sdb1 # offline check sudo resize2fs /dev/sdb1 100G # grow (online when supported) sudo e4defrag /dev/sdb1 sudo e2fsck -b 32768 /dev/sdb1 # backup superblock
When to use ext4
Good fit: root filesystems, general-purpose volumes, production hosts that value stability over fancy features.
Prefer something else when you need: snapshots or send/receive (Btrfs/ZFS), built-in checksums and self-healing (ZFS/Btrfs), compression by default (Btrfs/ZFS), multi-device pools (ZFS/Btrfs), or Windows interoperability (exFAT/NTFS).
| Feature | ext4 | XFS | Btrfs | ZFS |
|---|---|---|---|---|
| Maturity | High | High | Medium | High |
| Throughput | High | Very high | Medium | Medium |
| Features | Modest | Modest | Rich | Rich |
| Operational simplicity | Highest | High | Lower | Lowest |
Advanced knobs
- Inline data — tiny files stored inside the inode
- Metadata checksums —
tune2fs -O metadata_csumdetects metadata corruption (not full data scrubbing) - Lazy init — faster
mkfswith background inode/table zeroing
Monitoring and recovery
cat /sys/fs/ext4/sdb1/lifetime_write_kbytes sudo extundelete /dev/sdb1 --restore-all # best-effort undelete sudo e2fsck -y /dev/sdb1
Practices that matter
- Keep ordered journal mode unless you have a measured reason to change.
- Leave 10–20% free so allocation stays contiguous.
- Prefer UUIDs in
fstabover/dev/sdXnames. - Schedule checks; never treat the journal as a substitute for backups.
ext4 stays the Linux default because its failure modes and tools (e2fsck, tune2fs, debugfs) are well understood. Feature-rich filesystems win specialized jobs; for “make a reliable root volume,” ext4 still wins on simplicity.
Related concepts
Learn the Btrfs filesystem with built-in snapshots, RAID, and compression. Explore copy-on-write, subvolumes, and self-healing on Linux.
Understand Copy-on-Write (CoW) in Btrfs and ZFS. Learn how CoW enables instant snapshots, atomic writes, and data integrity.
Learn FAT32 and exFAT filesystems for cross-platform USB drives and SD cards. Understand file size limits and compatibility.
Learn how filesystem journaling prevents data loss during crashes. Explore write-ahead logging and recovery in ext4 and XFS.
Explore Linux filesystems through interactive visuals. Learn VFS, compare ext4 vs Btrfs vs ZFS, and understand file operations.
Understand Linux inodes - the metadata structures behind every file. Learn about hard links, soft links, and inode limits.
