[OpenIndiana-discuss] destroy all but specific snapshot
Tim Aslat
tim at spyderweb.com.au
Wed Oct 1 00:31:54 UTC 2014
Harry Putnam wrote on 01/10/2014 09:52:
> This is not so easy to find in google searches
>
> How does one go about destroying all but a specific snapshot? The one
> I want is somewhere in the middle timewise So not wanting to use
> `destroy -r'.
>
> This is in a .zfs/snapshot/* where there are many auto snaps. So
> looking for a way besides destroying -r or 1 by 1.
Hi Harry,
Simplest option would be something like
zfs list -t snapshot -o name -H -r filesystem/path > /tmp/snaplist.txt
edit /tmp/snaplist.txt to remove the snapshot you want to keep
for SNAP in `cat /tmp/snaplist.txt`
do
zfs destroy $SNAP
done
My syntax may be a little off with the for loop but I'm sure you get the
idea.
Cheers
Tim
--
Tim Aslat <tim at spyderweb.com.au>
Spyderweb Consulting
http://www.spyderweb.com.au
Mobile: +61 0401088479
More information about the openindiana-discuss
mailing list