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

one rollback and the weekend was mine again

A botched package upgrade left a box unbootable, and a btrfs snapshot taken minutes earlier put it right in seconds.

A Linux terminal

I did the thing you're not supposed to do on a Friday. I ran a big update on the home server, walked away to make tea, and came back to a box that wouldn't boot. A kernel and an initramfs had disagreed about something and the boot just hung. The old me would have reached for a rescue USB and an afternoon of resentment.

The current me has the root filesystem on btrfs, and a snapper snapshot taken automatically before every zypper transaction. So instead of rescuing anything, I booted the previous snapshot straight from the boot menu, confirmed the machine was healthy, and rolled the default subvolume back to it.

# snapper list
# snapper rollback 142
# reboot

That was the whole repair. Seconds, not hours. The broken state is still sitting there as a read-only snapshot if I ever want to work out what actually went wrong, which I probably won't.

The honest lesson is that snapshots are not backups, and I'd be cross with myself for implying otherwise. A snapshot on the same disk does nothing for you when the disk dies. But for the specific, common, self-inflicted case of "I changed something and now it's broken", a copy-on-write filesystem with automatic pre-transaction snapshots is the closest thing to an undo button a server has. It cost me nothing to set up and it just gave me my Saturday back.