Make ZFS auto-destroy snapshots when the out of space?
David Magda
dmagda at ee.ryerson.ca
Mon May 31 00:48:33 UTC 2010
On May 29, 2010, at 16:07, Kirk Strauser wrote:
> I'd propose standardizing on an attribute like
> org.freebsd:allowautodestroy. Modify ZFS's disk full behavior [...]
> Also run a daily periodic script to ensure that the free space stays
> below a configurable threshold each day so that ZFS isn't constantly
> butting up against completely full drives.
Why not simply have a script that runs and checks for pool usage and
then deletes snapshots with that attribute if necessary? Why do you
need to have have it built into ZFS?
> What do you think? It seems like this should be pretty easy to
> implement without requiring any upstream changes or new FreeBSD-only
> data structures. The whole thing could possibly be implemented in
> userspace, but I don't know that ZFS has any exception handling
> callbacks that would make it easy.
IMHO this shouldn't be built into the file system. You have one script
to automatically generate snapshots, and another to monitor usage and
delete old ones.
This idea was talked about on zfs-discuss in 2006:
http://mail.opensolaris.org/pipermail/zfs-discuss/2006-May/thread.html#2266
Good summary in this post:
http://mail.opensolaris.org/pipermail/zfs-discuss/2006-May/002313.html
Generally I don't think this is the "Unix Way". I don't want my kernel
doing stuff behind my back. If I want snapshots I'll create them
(scripted or manual); if I want to get rid of them for whatever
reason, I'll destroy them (scripted or manual). Either of these
behaviours can then be controlled by an rc.conf(5) variable perhaps.
There's already an useful creation tool for OpenSolaris:
http://src.opensolaris.org/source/xref/jds/zfs-snapshot/
There's also an auto-scrub script:
http://blogs.sun.com/constantin/entry/new_opensolaris_zfs_auto_scrub
More information about the freebsd-stable
mailing list