Make ZFS auto-destroy snapshots when the out of space?

Paul Mather paul at gromit.dlib.vt.edu
Mon May 31 13:48:55 UTC 2010


On May 30, 2010, at 10:35 PM, David Magda wrote:

> An event framework would certainly be helpful in a general sense (Linux has event(3) AFAIK), and that could certainly be useful for purging snapshots during resource constrained situations. But even if we don't have it, I doubt a fork(2) from cron(8) and a statfs(2) would be onerous on a system. :)

Devd already receives several ZFS-based events (failed vdev, I/O error, checksum mismatch, etc.), so perhaps it would be useful to add another, e.g., "space" which is set to be triggered when a pool attains a certain percentage full.  This could default to 100%, but be capable of being set lower by an associated kernel sysctl.  You could then have any auto-pruning/snapshot management script triggered from devd.  (You'd probably also have to figure out some kind of throttling mechanism for this devd event, too.)

Cheers,

Paul.



More information about the freebsd-stable mailing list