ext4 is the most widely used default filesystem in the world. This episode covers the concepts of data=ordered journaling, extents, flexible block groups, and delayed allocation, then hands-on practice with mkfs.ext4, tune2fs, dumpe2fs, e2fsck, and resize2fs.

This episode is your first hands-on practice: ext4. ext4 isn't the most advanced filesystem, but it's the most battle-tested — it's the default on Ubuntu, Debian, and almost all mainstream distros. For a SysAdmin, mastering ext4 means mastering 70 percent of storage operations in the field.
The core concepts of ext4 are journaling, extents, flexible block groups, and delayed allocation. Once you understand the concepts, we'll practice with the main tools: mkfs.ext4, tune2fs, dumpe2fs, e2fsck, and resize2fs. Every command in this episode can be run on the /dev/loop0 loopback disk prepared in episode 0.
Before continuing, make sure your lab is ready: verify the loop device is still attached and confirm there's no important data on it — mkfs will wipe everything.
ext4 inherits ext3's journaling. The default data=ordered mode writes data first, then records metadata to the journal. That means: if a crash happens, the filesystem recovers consistently without waiting for a full disk re-read, and you don't lose your directory structure.
The journal is allocated as an internal file or on a separate device (external journal) for very intensive workloads. The default size is around 128MB, or 1024 blocks per 256MB.
ext4 replaced a pure block bitmap with extents: each entry in an inode can reference millions of sequential blocks. This drastically cuts metadata overhead for large files.
Delayed allocation defers deciding where blocks go until data is actually about to be written to disk. The kernel accumulates data in the page cache, then allocates the most efficient blocks all at once. The effect: large files are more contiguous, I/O is reduced, and fragmentation drops. Note that delayed allocation means "used space" changes can appear delayed in df.
Load the disk image and format it as ext4:
sudo losetup -f /tmp/lab.img
sudo losetup -l
sudo mkfs.ext4 -L lab-data /dev/loop0The lab-data label is written to the superblock. Without a partition, mkfs marks the disk as a complete filesystem; in the real world the device used is usually a partition like /dev/sdb1.
Inspect the details that were created:
sudo dumpe2fs -h /dev/loop0Look at the Block size, Inode count, Journal size, and Filesystem features lines — that's where extents, flexible block groups, and metadata checksums are visible.
mke2fs (the generic name for mkfs.ext4) offers tuning options:
-b <size>: block size, 1024, 2048, or 4096 bytes.-N <count>: number of inodes created, for filesystems with millions of small files.-m <percent>: percentage of reserved blocks for root (default 5%).-O <features>: enable/disable features like metadata_csum, 64bit, or ^has_journal.An example of creating ext4 without a journal (for special cases like read-heavy SSDs):
sudo mkfs.ext4 -O ^has_journal /dev/loop0The mkfs.ext4 -O ^has_journal command disables journaling — not recommended without a strong reason, because all crash protection is lost.
tune2fs changes filesystem parameters without deleting data. Common operations include changing the label, block reservation, and fsck schedule:
sudo tune2fs -L data-baru /dev/loop0
sudo tune2fs -m 1 /dev/loop0
sudo tune2fs -c 30 /dev/loop0-m 1 lowers the reserved blocks from 5% to 1% (recovering a lot of space on large disks), and -c 30 forces fsck to run after 30 mounts.
e2fsck (alias fsck.ext4) checks consistency. Run it only while the filesystem is unmounted:
sudo umount /mnt/lab
sudo e2fsck -f -y /dev/loop0-f forces a full check even if the status is clean, -y answers yes to all repairs. If the primary superblock is damaged, use -b 32768 to use a backup superblock.
resize2fs adjusts the filesystem size. The correct order when growing a partition: resize the partition first (with parted/fdisk), then run resize2fs. Conversely, when shrinking: shrink the filesystem first, then the partition.
Simulate on the loopback device:
sudo resize2fs /dev/loop0Without a size argument, resize2fs adjusts to the full device size. To shrink, give a target size like resize2fs /dev/loop0 1G.
Warning
Online resizing of a mounted filesystem is only supported for growing ext4. Shrinking must be done while unmounted, and always back up before this operation.
ext4 is the operational foundation of Linux filesystems. By mastering data=ordered journaling, extents, flexible block groups, and delayed allocation, plus the mkfs, tune2fs, dumpe2fs, e2fsck, and resize2fs tools, you can already manage the majority of Linux servers in the real world.
Key takeaways:
data=ordered journaling: safe and balanced.dumpe2fs -h is the primary way to inspect the ext4 superblock.e2fsck must run while the filesystem is unmounted.resize2fs can grow online; shrinking must be done offline.In the next episode, episode 4, we move to XFS — design, tools, and operations — the RHEL default filesystem with allocation groups and B+trees designed for high throughput. You'll see how XFS's design differs completely from ext4 and when it's the right choice.