[OpenIndiana-discuss] How to let find 'see' .zfs directories

Timothy Coalson tsc5yc at mst.edu
Thu Mar 20 05:50:03 UTC 2014


There is the "snapdir" property, which when set to "hidden" will prevent
things from knowing that the .zfs directory is there from a directory
listing - note, however, that changing it to show the directory may cause
GNU find to behave strangely whenever it looks at the root of a zfs
filesystem (including over nfs) if you don't turn off a particular
optimization based on link counts (I believe you need to use -noleaf) - the
.zfs directory isn't counted in the link counts, so it may think it is done
finding subdirectories before it actually is.

You could instead test for the existence of the .zfs directory in all
folders, with some kind of "find . -type d -exec 'test -d {}/.zfs'"
construct (I have not tested that line).  The scripts I use with snapshots
use a lot of "zfs list -H -o name" ("-d 1 -t snapshot" is useful with a
filesystem) and "zfs get -Hp", other solutions might give false positives
("mkdir .zfs" doesn't complain when not in the root of a zfs filesystem).
Unless you want to run the script over NFS or something...

Tim



On Wed, Mar 19, 2014 at 10:02 PM, Harry Putnam <reader at newsguy.com> wrote:

> Probably some obvious thing going on here but I'm not see how find all
> '.zfs' directories under a zfs system hierarchy.
>
> Just running something like
>
>   cd /rmh/   (that is 'p2/rmh' in zpool talk)
>
>   find . -type d -name 'snapshot'
>
> No hits whatsoever, when I know there are 4-5 under there.
>
> I wanted to setup some homeboy snapshot destroys on the basis of mving
> to all .zfs/snapshot directories and using ls -t, sed, zfs snapshot
> destroy to
> get rid of snaps beyond the most recent 8 in the directory
>
> So is something like 'zfs -H -t snapshot -o name' the only way to
> ferret out actual addresses of the snaps?
>
> I'd sooner use basic oldschool unix tools if possible
>
>
> _______________________________________________
> OpenIndiana-discuss mailing list
> OpenIndiana-discuss at openindiana.org
> http://openindiana.org/mailman/listinfo/openindiana-discuss
>


More information about the OpenIndiana-discuss mailing list