Anders Tall

Filesystems, end to end: create, grow, shrink, verify

4 min read

Most filesystem tutorials are one command: mkfs.ext4 /dev/sdb1 and done. That gets you a filesystem, but not the model behind it. The model is what you need when the disk is full, the partition is wrong, or the filesystem is on fire.

This is the hub for a series about the operations that matter, each one demonstrated on a real block device in a disposable lab:

Each part is a set of short, silent videos, and this page is the written companion. The point is not to memorise flags; it’s to know which of these operations your filesystem can do, in which order, and what it costs.

The model: device, partition, filesystem

Almost every mistake in this area comes from mixing up three layers:

disk  /dev/sdb
  └── partition  /dev/sdb1
        └── filesystem  ext4 / xfs / btrfs / ufs / ntfs

A filesystem lives inside something: a partition, an LVM volume, or a whole disk. Growing the filesystem without growing the container does nothing; growing the container without growing the filesystem leaves free space unused. Shrinking is the reverse order, and some filesystems are designed so they can’t do it at all.

ZFS is the main exception: it does not use partitions the same way. You give it devices (or partitions) and it builds a pool; datasets are the filesystems inside the pool. APFS is the other: a container holds volumes. That is why the ZFS page starts with zpool create, not mkfs, and the APFS page with diskutil eraseDisk.

The matrix

Operationext4XFSBtrfsZFSUFSNTFSAPFS
Createmkfs.ext4mkfs.xfsmkfs.btrfszpool create + zfs createnewfsFormat-Volumediskutil eraseDisk
Growgrowpart + resize2fs (online)growpart + xfs_growfs (online)btrfs filesystem resize (online)grow the pool; datasets followgpart resize + growfs (online)Resize-Partition (online)resizeContainer (online)
Shrinkresize2fs (offline) + partitioncan’tbtrfs filesystem resize (online)only via zpool remove (no raidz)can’t (growfs only)Resize-Partition (online)resizeContainer (online)
Check / repaire2fsck (offline)xfs_repair (offline)btrfs check (offline) + scrub (online)zpool scrub (online)fsck_ufs (offline)Repair-Volume -Scan (online) / chkdsk /f (offline)verifyVolume (online) / fsck_apfs -n (offline)
Snapshotsvia LVMvia LVMnative (subvolume)native (dataset)mksnap_ffs (limited)VSSTime Machine local
Compression——zstdzstd—compact (per file/folder)per file (ditto --hfsCompression; no diskutil switch)
Replicatersyncrsyncbtrfs send/receivezfs send/receiversyncrobocopy / rsyncrsync

Two asymmetries are worth internalising:

The filesystems

Each page links to its videos when they are published, and each video links back here.

Where this ends

That’s the full set for now: four Linux filesystems, FreeBSD, Windows and macOS. The model stays the same across all of them; only the commands change.

The one rule throughout: run it on a scratch disk first. A lab you can destroy is what makes the dangerous operations teachable.

#filesystems #ext4 #xfs #btrfs #zfs #ufs #freebsd #ntfs #apfs #linux #storage #homelab #devops