How to access my NFS share

Here at the BIC, NFS shares are handled via autofs

Autofs is a linux service that manages mount points as needed: it only mounts a given mount point (NFS share) when that share is accessed and it will be unmounted after a defined period of inactivity (currently set to 5 minutes).

the keyword here is unmounted, hence it will no longer be listed by commands like ls or df … or inside your file browser.

here’s an example:

$ cd /data/scratch

$ ls -al

total 0
drwxr-xr-x  2 root root 0 Nov 27 14:13 .
drwxr-xr-x 24 root root 0 Dec 12 10:56 ..

$ df -h scratch1

Filesystem                           Size  Used Avail Use% Mounted on
nfs.isi.bic.mni.mcgill.ca:/scratch1   25G  4.0G   22G  16% /data/scratch/scratch1

$ ls -al

total 2
drwxr-xr-x  3 root root   0 Dec 13 13:00 .
drwxr-xr-x 24 root root   0 Dec 12 10:56 ..
drwxrwxrwt  3 root wheel 31 Dec 13 06:00 scratch1

A quick howto on how to share data access with your group…

In this example the username is “bluser” and the group with which that user wants to share data is “analysis”…

$ id bluser
uid=1854(bluser) gid=200(pet),260(analysis)

$ pwd
/data/analysis1/workspace

$ ls -al

total 36
drwxr-xr-x  2 bluser analysis   0 Mar 19 13:03 .
drwxrwx--x 23 root   analysis 756 Mar 19 13:03 ..

$ chmod g+ws .

$ ls -al

total 36
drwxrwsr-x  2 bluser analysis   0 Mar 19 13:03 .
drwxrwx--x 23 root   analysis 756 Mar 19 13:03 ..

Create a file that I can source to set umask…

$ echo ‘umask 0002’ > .umask
$ source .umask
$ umask
0002
$ touch ftest
$ mkdir dtest
$ ls -ald ftest dtest

drwxrwsr-x 2 bluser analysis 0 Mar 19 13:15 dtest
-rw-rw-r-- 1 bluser analysis 0 Mar 19 13:15 ftest

This method requires some discipline, i.e. one has to source the .umask file before doing any work but one could also automate the process with a bash function:

$ function cdw () { cd “$1”; [[ -e .umask ]] && source .umask; }

Hence using cdw instead of cd will automatically do this for you as long as you create a proper .umask file wherever needed.

Another approach is to set an ACL and for more info on the subject you can read the man pages for the following:

$ man nfs4_acl
$ man nfs4_editfacl
$ man nfs4_getfacl
$ man nfs4_setafcl

The following link could also prove quite useful:

Now in the context of our above situation, a quick example to give the “analysis” group write access…

$ nfs4_setfacl -a A:g:analysis:rxtncy dtest
$ nfs4_getfacl dtest

# file: dtest
A::GROUP@:rxtncy
A::OWNER@:rwaDdxtTnNcCoy
A::GROUP@:rwaDxtTnNcy
A::EVERYONE@:rxtncy

you’ll notice some redundant permissions here but I’ll let the reader figure that out! :wink:

some useful links regarding linux permissions …