[OpenIndiana-discuss] destroy all but specific snapshot
Jason Matthews
jason at broken.net
Wed Oct 1 02:52:35 UTC 2014
Yah, the paranoid part of my reptilian brain tells me not to issue a destroy command on a resource I want to keep.
That said, it should be fine.
Sent from my iPhone
> On Sep 30, 2014, at 6:53 PM, Harry Putnam <reader at newsguy.com> wrote:
>
> Tim Aslat <tim at spyderweb.com.au> writes:
>
>> 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
>
> Thanks for the input... I did think of something like that employing
> a four loop but it seemed a bit cumbersome
>
> So I thought I'd check once more thru the oracle stuff online about
> snapshots and damned if I didn't stumble up on something that seems to
> be one way to go, honestly its not a whole lot less (if any) less
> cumbersome though.
>
> http://docs.oracle.com/cd/E19253-01/819-5461/6n7ht6r4f/index.html
> (Look under Holding ZFS Snapshots)
>
>
> It revolves around the `hold' command which is really more of a
> property I guess.
>
> You pick out the snap[s] you want (in my case it was just one) and
> label it with: `zfs hold LABEL zp/path/dir at SNAP'
>
> Then you maybe use the -r flag with destroy or a four loop like I did:
>
> I didn't have any complicated snaps behind clones or what not.
>
> cd .../.zfs/snspshot
>
> for SNAP in `ls -d *`;do zfs destroy zp/path/dir@${SNAP};done
>
> When it hits the one with the `hold NAME' it reports that fact then
> finishes off the rest.
>
> You can then `release' the `hold' with: zfs release zp/path/dir at SNAP
>
>
> _______________________________________________
> openindiana-discuss mailing list
> openindiana-discuss at openindiana.org
> http://openindiana.org/mailman/listinfo/openindiana-discuss
>
More information about the openindiana-discuss
mailing list