
On Sun, 9 Dec 2012, "Trent W. Buck" <trentbuck@gmail.com> wrote:
Russell Coker <russell@coker.com.au> writes:
Does anyone know of a good script for managing btrfs snapshots for different frequencies of backups? [...] like every 15 minutes for the last 24 hours, every 8 hours for the previous 30 days, and every day for the 100 days before that.
Actually taking the backups is trivial - a fifteen minute cron job.
Yes.
At the end of that job, you expire any snapshots that are superfluous to your rotation policy -- e.g. if it's four hourlies and seven dailies, then you expire the fifth hourly &c
That's the hard part.
My immediate inclination would be to rip the code for that out of rsnapshot. However IIRC that relies heavily on the snapshots being named <rotation>.<Nth>, which is why at Cyber we have an in-house Python script for expiring superfluous ZFS snapshots.
I want to have human-readable names so that I can instruct people over the phone. I want to say "go to ~/2012-12-09-06:15 and you'll find the old version of your file". Even working out which rotation.nth directory corresponds to the last time the file was good would be too much effort to do over the phone. Also for the cases where there's more than one user I'll probably make snapshots in the home directory for each user. Currently I don't run a workstation that has enough users for this to be any sort of problem, the maximum number of workstation users that are important enough for a backup is 2.
If you're interested, let me me know and I'll see if I can publish it (it's not my code so I have to ask first.)
Please do that. -- My Main Blog http://etbe.coker.com.au/ My Documents Blog http://doc.coker.com.au/