Ramblings of an aging IT geek
← Ramblings of an aging IT geek
linux

moving my root filesystem onto zfs

Notes from moving a home server's root filesystem onto ZFS on Linux, and the boot quirks that came with it.

A terminal session on a Linux box

I have run ZFS on a separate data pool for years, but root has always stayed on ext4 because the boot story used to be fiddly. With ZFS on Linux now at 0.6.5 and shipping properly in the distro I run, I finally moved the lot across. The thing I actually wanted was boot environments: snapshot the root, do something reckless, roll back if it bites me.

The setup is a single mirrored pool, rpool, with the root in its own dataset and a separate dataset for /home. The one detail worth writing down: zfs must be in the initramfs, and the pool needs cachefile set or the import fails on the next boot and you land in an emergency shell with no obvious clue why. I lost twenty minutes to exactly that.

zfs set mountpoint=/ rpool/ROOT/default
zpool set cachefile=/etc/zfs/zpool.cache rpool
update-initramfs -u

Two weeks in, the snapshot-before-upgrade habit has already saved me once. zfs rollback after a bad kernel update is so much calmer than reaching for a rescue USB. I would still keep root simple on a machine I cannot physically touch, but for a box on the desk next to me this is a clear win.