Make ZFS auto-destroy snapshots when the out of space?
Kirk Strauser
kirk at strauser.com
Sun May 30 22:03:47 UTC 2010
On May 29, 2010, at 9:58 PM, Garrett Cooper wrote:
> So basically you're saying deal with an LRU snapshot deletion when you
> reach a certain threshold of free space, type scheme? This might get
> tricky, but it does lend itself to other systems I suppose (I hate to
> mention it, but the best one I can think of is Windows' system
> restore... there might be something else available with OSX's Time
> Machine).
Time Machine works almost exactly that way. It stores as far back in
history as you have hard drive space to hold it.
> What would be more tricky is when the automated system is filling in a
> bunch of useless snapshots unnecessarily, but as you'd be providing
> the snapshot criteria, I suppose that you would know what snapshots
> you want to save and what ones you want to toss...
I don't think add any trickery. The snapshots are again analogous to
how Time Machine works, where you have hourly snapshots, then a week's
worth of daily, then a month's worth of weeklies, then as many monthly
snapshots as will fit on your hard drive. If you run out of space,
delete November, then December.
> It's an interesting thought though -- just increases the overall
> complexity of the system and may only meet one need.
I think the additional complexity would amount to adding a config
option to the code that gets run when a disk is full that executes an
arbitrary command, namely a user-space shell script that deletes the
oldest automatically-generated snapshot.
The "only one need" that it addresses is that now FreeBSD would come
with a built-in recovery system. Did a "make installworld" but screwed
something up and ended up with a non-bootable system? Pop in a
recovery CD and revert to the "4 hours ago" snapshot, then reboot.
Voila! It never happened. Accidentally deleted /etc/passwd? Retrieve
the version from /.zfs/snapshot/weekly-2010-21/etc/passwd . Just
realized that you deleted an important file 3 months ago and only keep
2 weeks worth of backups? No problem, as long as you haven't filled up
your hard drive since then.
--
Kirk Strauser
More information about the freebsd-stable
mailing list