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

moving root onto zfs and not regretting it

Reinstalling a workstation with root on ZFS, and the one feature that makes the extra fiddliness worth it.

A Linux terminal with a filesystem layout

I finally put root on ZFS when I rebuilt my workstation, having dithered about it for years because the install dance is fiddlier than just letting the installer lay down ext4 and walking away. The dithering was a mistake. The one feature that justifies the whole exercise is boot environments, and I should have done it ages ago.

The pitch is simple. Before any risky change, a kernel upgrade, a driver swap, a distribution bump, you snapshot the dataset that holds root. If the change goes badly, you reboot and select the snapshot from the boot menu, and you are back exactly where you were, in seconds, with nothing lost. No reinstall, no rescue USB, no picking through /etc trying to remember what you touched.

zfs snapshot rpool/ROOT/default@pre-upgrade
# do the scary thing, and if it breaks:
# reboot, pick the snapshot, carry on

The cost is real but bounded. You need the ZFS module available at boot, which means either a distribution that ships it or some initramfs work, and you have to think about ARC memory usage on a machine that is also trying to run a desktop. Neither is hard once, and neither comes back to bite you.

What surprised me is how much it changes my attitude to maintenance. I used to put off upgrades because the downside was an evening lost to a broken boot. Now the downside is a thirty-second rollback, so I just do them. The safety net does not only catch you when you fall, it makes you willing to climb in the first place.