Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 30 May 2010 22:27:20 -0400
From:      jhell <jhell@dataix.net>
To:        Kirk Strauser <kirk@strauser.com>
Cc:        FreeBSD-STABLE Mailing List <freebsd-stable@freebsd.org>, Dan Nelson <dnelson@allantgroup.com>
Subject:   Re: Make ZFS auto-destroy snapshots when the out of space?
Message-ID:  <4C031E88.9060205@dataix.net>
In-Reply-To: <93F986A6-DAEB-47B4-AB8C-5A095E61A7B7@strauser.com>
References:  <4C017419.9010909@strauser.com> <20100530024240.GE8866@dan.emsphone.com> <93F986A6-DAEB-47B4-AB8C-5A095E61A7B7@strauser.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 05/30/2010 18:06, Kirk Strauser wrote:
> On May 29, 2010, at 9:42 PM, Dan Nelson wrote:
> 
>> If the kernel does the snapshot deleting itself, why not add a pool-level
>> property that sets the amount of free space at which the deletion starts?
>> That way you don't need the cleanup script.  Alternatively, make the
>> org.freebsd:allowautodestroy property hold the trigger freespace amount.
>> That way you can have monthly/daily/hourly snapshots but set it so the
>> hourly ones disappear first, then the dailies (by setting the destroy
>> trigger slightly higher for the ones you want to expire first).
> 
> 
> That'd definitely work. The idea was to keep as much as possible out of
> the kernel so that it wouldn't add additional complexity for people who
> don't use it (but it certainly wouldn't offend me any to find it in
> there :-) ).

I think this would probably be best handled by the script that is
creating the snapshots. Though this is a nice feature how well would it
be received upstream and in what period of time would we have to wait
while maintaining are down-level patches.

I would propose looking at the creation time of the snapshots while in
creation mode and parsing for a time that is older than a use
configurable variable so the script can take proper action when
destroying snapshots before it tries to create a new one and look at a
value comprised of either the quota property or a attribute like the
previous one stated.

I strongly urge against creating a attribute that the script would look
for due to the reason it would take more involvement with the script to
be specific to FreeBSD where as now it should be OS independent.

# This works good enough to compare with date(1) "+%s"
zfs get -o name,value creation | grep @

# This works for seeing exactly how much a snapshot is using
zfs get -o name,value used |grep @

Between the above two examples a threshold can be achieved at which
older data can expire faster or slower depending on your settings and
provide an upper tolerance for space usage.

Of course this can be refined and there is a whole lot that is left to
be scripted around the above commands.

Regards,

.02

-- 

 jhell



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4C031E88.9060205>