I’ve been a very happy user of btrfs-snap for quite a while now. It is great for taking snapshots of a volume at regular intervals. In my opinion, this is a bit wasteful and cumbersome for the root volume. I don’t tend to change things on the root volume every hour, or even every day.
Ubuntu 11.10 now has
apt-btrfs-snapshot available in the universe repository. This is an awesome little script that hooks into
apt to create a snapshot right before packages are installed or upgraded.
The only thing I wasn’t too happy about was that
apt-btrfs-snapshot doesn’t do any cleanup of old snapshots, so things were getting cluttered pretty quickly:
Cleaning things up a bit
I threw together my own little snapshot cleanup script to hook into
apt. It automatically removes all but the five most recent snapshots. That should be enough history to keep me safe.
Still using btrfs-snap as a safety net
I’m still using btrfs-snap on my root volume, but I’m not keeping anywhere near as much history as I used to. I’m only keeping a few hourly snapshots and one weekly snapshot. I’ll probably end up dropping the weekly snapshot.
1 2 3 4 5 6 7 8 9 10 11 12 13
I also created a file called
/etc/apt/apt.conf.d/81-btrfs-snapshot-cleanup containing this line:
This will make
apt run this script right after it takes a snapshot. Just tweak that line to match the location of your