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 little 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](http://blog.patshead.com/2010/09/simple-automated-btrfs-snapshots-with-btrfs-snap.html) 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.
This will make apt run this script right after it takes a snapshot. Just tweak that line to match the location of your apt-btrfs-snapshot-cleanup.sh script.
See also:
- How I Reduced My Virtual Machine Disk Images By Over 75% With QEMU
- Experimenting with Compressed Swap
- Fix for Karmic Koala 64-bit Flash Plugin
- Saving Space With fusecompress
- Using QR Codes for Hardcopy Backups of Private Keys
- Achieving Better Compression with lrzip and rzip
- Testing btrfs Root File System on Ubuntu
- Automatically Configuring Multiple Heads with x.org
- Thoughts After Running btrfs for a Month
- Simple Automated btrfs Snapshots with btrfs-snap
- Linux Kernel 2.6.36 on the HP Pavilion DV8T
- Tweak btrfs-snap for More Frequent Snapshots
- My Backup Strategy for My Laptop
- btrfs - Six Months Later
- Disable the 'Resize Window Grippers' in Ubuntu 11.04 Natty Narwhal
- My First btrfs Failure and the State of Ubuntu's btrfs Support
- Supplimenting btrfs-snap With apt-btrfs-snapshot
- Whole Disk Encryption with an SSD
- My BIOS is Limiting My CPU Clock Speed!
- Why Do I Run Ubuntu?



Follow Pat Regan on Twitter
Follow Pat Regan on Google+
Subscribe to the RSS feed
Leave a comment