Colorfully Manage Btrfs Snapshots

August 07, 2015 – tagged as btrfs, ruby, snapshots, subvolumes

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.

Btrfs rotate

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.

Comments

Email mark@markmcb.com with questions, comments, or links to external discussions.
Privacy Note: I will not post your email address in the comments unless you request it.

deabru • August 10, 2015 • Reply

Snapper! So beatiful integrated on openSUSE

But very visual script yours