ext3 vs ext4 Explained: Linux File Systems for Linux+ and A+

ext4 is the default file system on most Linux distributions, and ext3 is its predecessor. The exams test what journaling gives you, what ext4 added, and how these compare with the other file systems you will meet.

Journaling

The feature that defines both, and the reason ext2 is obsolete.

A journaling file system records its intended changes in a journal before making them. After a crash the system replays or discards the journal rather than scanning the entire file system for inconsistencies. On ext2, an unclean shutdown meant an fsck that could take hours on a large volume. On ext3 and ext4 it takes seconds.

ext3 offers three journaling modes, and they come up as a comparison.

ModeWhat is journaledTrade-off
journalMetadata and dataSafest, slowest
ordered (default)Metadata, with data written firstGood balance
writebackMetadata onlyFastest, may expose stale data after a crash

Ordered is the default because it prevents the worst outcome — metadata saying a file is written while the data blocks still hold whatever was there before.

What ext4 added

Extents. ext3 tracked files as lists of individual blocks, which became unwieldy for large files. ext4 uses extents — contiguous ranges described by a start and a length. Less metadata, less fragmentation, faster large-file handling.

Much larger limits. ext3 tops out at 2 TB per file and 32 TB per volume. ext4 allows 16 TB per file and 1 EB per volume.

Delayed allocation. Block allocation is deferred until data is flushed, so the file system can choose contiguous space once it knows the full size. Better layout, less fragmentation.

Journal checksums. Corruption in the journal itself is detected rather than replayed.

Faster fsck. Unused inode groups are marked and skipped, so a check covers only what is in use.

Nanosecond timestamps, and dates beyond the 2038 limit that constrained ext3.

Compatibility

A point the exam likes: the ext family is forward and backward compatible in useful ways. An ext3 file system can be mounted as ext4 without conversion, and can be upgraded in place by enabling ext4 features — though existing files keep the old block mapping and only new files use extents. An ext4 file system that has not enabled extents can still be mounted as ext3.

The commands

Linux+ expects the tooling, not just the theory.

mkfs.ext4 /dev/sdb1 creates the file system. fsck or e2fsck checks it — on an unmounted volume only; running it on a mounted file system risks corruption. tune2fs -l displays parameters and tune2fs adjusts them, including the reserved-blocks percentage. resize2fs grows or shrinks; ext4 can grow while mounted but must be unmounted to shrink. dumpe2fs shows detailed superblock and group information. blkid reports the UUID, which is what /etc/fstab should reference rather than a device name that can change between boots.

Note the reserved blocks: by default 5% of the volume is reserved for root, which prevents a full disk from locking out administrative recovery. On a large data volume that is a lot of wasted space, and reducing it with tune2fs -m 1 is a normal thing to do.

Compared with the alternatives

XFS is the default on RHEL and derivatives. Excellent with large files and parallel I/O, can grow but not shrink.

Btrfs offers copy-on-write, snapshots, built-in RAID and checksumming — closer in capability to ZFS or APFS.

ZFS combines volume management and file system with strong integrity guarantees, but licensing keeps it out of the mainline kernel.

swap is not a file system in the ordinary sense; it is the partition or file used for paging.

If a question asks for snapshots and checksumming, the answer is Btrfs or ZFS, not ext4. If it asks for the safe general-purpose default, it is ext4.

What to remember

Journaling means fast recovery after a crash, and ordered mode is the default. ext4 added extents, delayed allocation, journal checksums and far larger limits — 16 TB per file, 1 EB per volume, against ext3's 2 TB and 32 TB. Never fsck a mounted file system. ext4 grows online but must be unmounted to shrink. Reference volumes by UUID in fstab.

Related reading: Linux permissions · The APT package manager · FAT32 file system

Comments