Subvolumes and copy-on-write snapshots are some of the nice features of Btrfs, but not something you really want to manage manually. It’s easy enough to cron snapshots, but you might want a non-linear retention policy, and you might want some insights from time-to-time regards what you’re retaining. I wrote a quick script to: 1) be cron-able, 2) be verbose if run manually, 3) be colorful to help readability.

Note in this case that it sees a previous manual snapshot I’d created that is within my retention policy and decides to keep it. Also note, that I had a snapshot for today already so the action was to replace it.

If you’re interested, I’ve posted it as btrfs_snapshot_rotate.rb to GitHub and will extend/refactor it over time.