Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 31 May 2010 03:15:02 +0200
From:      Christof Schulze <christof.schulze@gmx.com>
To:        freebsd-stable@freebsd.org
Subject:   Re: Make ZFS auto-destroy snapshots when the out of space?
Message-ID:  <201005310315.03255.christof.schulze@gmx.com>
In-Reply-To: <613D3C80-85F6-4A52-8C33-7F5AF18A3A2E@strauser.com>
References:  <4C017419.9010909@strauser.com> <201005310234.47363.christof.schulze@gmx.com> <613D3C80-85F6-4A52-8C33-7F5AF18A3A2E@strauser.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Am Montag 31 Mai 2010 02:40:00 schrieben Sie:
> On May 30, 2010, at 7:34 PM, Christof Schulze wrote:
> > still struggling with the attachment remover. So here is the script:
> > 
> > http://paste.pocoo.org/show/220207/
> 
> That's pretty similar in concept to the scripts I found and am using,
> but with the difference that those scripts use "zfs snapshot -r" to
> take a recursive, atomic snapshot of all filesystems in the configured
> pools. I wrote a separate script to prune all the unwanted filesystems
> (/tmp, and so on) regularly:

might be useful to have this a second script. 
During the last few minutes I put in the size-based removal:

http://paste.pocoo.org/show/220213/

using -r would require to remove the unwanted snapshots lateron but it 
might be worth it because of having it atomic.

Regards

Christof

> 
> #!/bin/sh
> 
> # If there is a global system configuration file, suck it in.
> #
> if [ -r /etc/defaults/periodic.conf ]
> then
>      . /etc/defaults/periodic.conf
>      source_periodic_confs
> fi
> 
> filesystems=$hourly_zfs_snapshot_prune_filesystems
> 
> case "$hourly_zfs_snapshot_prune_enable" in
>      [Yy][Ee][Ss])
>          if [ -z "$filesystems" ]; then
>              echo "Hourly snapshot pruning is enabled but not
> configured."
>              exit 2
>          fi
>          for filesystem in $filesystems ; do
>              zfs list -H -o name -t snapshot | grep -E "^
> $filesystem@(hourly|daily|weekly|monthly)" | xargs -n1 zfs destroy
>          done
>          ;;
>      *)
>          ;;
> esac


-- 
()  ascii ribbon campaign - against html e-mail 
/\  www.asciiribbon.org   - against proprietary attachments



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201005310315.03255.christof.schulze>