[OpenIndiana-discuss] Which OI service cleans up hidden NFS files?

Judah Richardson judahrichardson at gmail.com
Tue May 4 23:42:01 UTC 2021


nfsfind script is as follows:

if [ ! -s /etc/dfs/sharetab ]; then exit ; fi

# Get all NFS filesystems exported with read-write permission.

DIRS=`/usr/bin/nawk '($3 != "nfs") { next }
        ($4 ~ /^rw$|^rw,|^rw=|,rw,|,rw=|,rw$/) { print $1; next }
        ($4 !~ /^ro$|^ro,|^ro=|,ro,|,ro=|,ro$/) { print $1 }'
/etc/dfs/sharetab`

for dir in $DIRS
do
        find $dir -type f -name .nfs\* -mtime +7 -mount -exec rm -f {} \;
done

Here's what's in /etc/dfs/sharetab:

/znapzend/DellOptiPlex390MT/ROOT/openindiana    -       nfs     sec=sys,rw=@
192.168.0.107/32,root=@192.168.0.107/32
/znapzend/DellOptiPlex390MT/export/home/judah   -       nfs     sec=sys,rw=@
192.168.0.107/32,root=@192.168.0.107/32
/znapzend/DellOptiPlex390MT     -       nfs     sec=sys,rw=@
192.168.0.107/32,root=@192.168.0.107/32
/rpool1 -       nfs     sec=sys,rw=@192.168.0.107/32,root=@192.168.0.107/32
/znapzend       -       nfs     sec=sys,rw=@
192.168.0.107/32,root=@192.168.0.107/32
/znapzend/DellOptiPlex390MT/export      -       nfs     sec=sys,rw=@
192.168.0.107/32,root=@192.168.0.107/32
/znapzend/DellOptiPlex390MT/export/home -       nfs     sec=sys,rw=@
192.168.0.107/32,root=@192.168.0.107/32
/znapzend/DellOptiPlex390MT/ROOT        -       nfs     sec=sys,rw=@
192.168.0.107/32,root=@192.168.0.107/32

Now, I only ever explicitly (i.e. manually executed a command to) NFS
shared rpool1. It looks like all the child filesystems (created afterwards)
got shared too.

Let's see what happens when I try to unshare the child datasets:

# zfs set sharenfs=off rpool1/znapzend

Now /etc/dfs/sharetab contains:

/rpool1 -       nfs     sec=sys,rw=@192.168.0.107/32,root=@192.168.0.107/32

$ cd /rpool1 (where rpool1 is mounted) works, so I think that should fix
the problem, in theory. Unless anyone thinks it won't, in which case I urge
you to speak up :)

Thank you for the investigative direction idea and you and Alan both for
the quick replies.

On Tue, May 4, 2021 at 6:28 PM Joshua M. Clulow via openindiana-discuss <
openindiana-discuss at openindiana.org> wrote:

> On Tue, 4 May 2021 at 16:25, Judah Richardson <judahrichardson at gmail.com>
> wrote:
> > Extremely stupid question: is the fact that those mounted locations
> contain
> > ZFS snapshots resulting from znapzend's underlying use of zfs send &
> receive
> > and not actual physical directories possibly why find, cd, etc. can't
> reach
> > them?
> >
> > Shooting in the dark here; that's the only thing I can come up with.
>
> I think it would be easiest to take a look at the shell script and see
> what it gets out of sharetab and what it does with find.
>
> Cheers.
>
> --
> Joshua M. Clulow
> http://blog.sysmgr.org
>
> _______________________________________________
> openindiana-discuss mailing list
> openindiana-discuss at openindiana.org
> https://openindiana.org/mailman/listinfo/openindiana-discuss
>


More information about the openindiana-discuss mailing list