Mount an NFS export example

When you mount an export, you must ensure that the following prerequisites steps are carried out:

  • The bucket owner name is mapped to a Unix UID.
  • A default group is assigned to the bucket and the name of the default group is mapped to a Linux GID. This ensures that the default group shows as the associated Linux group when the export is mounted.
  • You review the Best practices for mounting ECS NFS exports.

The following steps provide an example of how to mount an ECS NFS export file system.

  1. Create a directory on which to mount the export. The directory should belong to the same owner as the bucket.
    In this example, the user fred creates a directory /home/fred/nfsdir on which to mount an export.
    su - fred
    mkdir /home/fred/nfsdir
  2. As the root user, mount the export in the directory mount point that you created.
    mount -t nfs -o "vers=3,nolock" 10.247.179.162:/s3/tc-nfs6 /home/fred/nfsdir

    When mounting an NFS export, you can specify the name or IP address of any of the nodes in the VDC or the address of the load balancer.

    It is important that you specify -o "vers=3".

  3. Check that you can access the file system as user fred.
    1. Change to user fred.
      $ su - fred
      
    2. Check you are in the directory in which you created the mount point directory.
      $ pwd
      /home/fred
    3. List the directory.
      fred@lrmh229:~$ ls -al
      total
      drwxr-xr-x  7 fred  fredsgroup    4096 May 31 05:38 .
      drwxr-xr-x 18 root  root         4096 May 30 04:03 ..
      -rw-------  1 fred  fred           16 May 31 05:31 .bash_history
      drwxrwxrwx  3 fred  anothergroup   96 Nov 24  2015 nfsdir
      

      In this example, the bucket owner is fred and a default group, anothergroup, was associated with the bucket.

    If no group mapping had been created, or no default group has been associated with the bucket, you will not see a group name but a large numeric value, as shown below.
    fred@lrmh229:~$ ls -al
    total 
    drwxr-xr-x  7 fred  fredssgroup  4096 May 31 05:38 .
    drwxr-xr-x 18 root  root         4096 May 30 04:03 ..
    -rw-------  1 fred  fred           16 May 31 05:31 .bash_history
    drwxrwxrwx  3 fred  2147483647     96 Nov 24  2015 nfsdir

    If you have forgotten the group mapping, you can create appropriate mapping in the ECS Portal.

    You can find the group ID by looking in /etc/group.
    fred@lrmh229:~$ cat /etc/group | grep anothergroup
    anothergroup:x:1005:
    
    And adding a mapping between the name and GID (in this case: anothergroup => GID 1005).
If you try and access the mounted file system as the root user, or another user that does not have permissions on the file system, you will see ?, as below.

root@lrmh229:~# cd /home/fred
root@lrmh229:/home/fred# ls -al
total 
drwxr-xr-x  8 fred  fredsgroup 4096 May 31 07:00 .
drwxr-xr-x 18 root  root       4096 May 30 04:03 ..
-rw-------  1 fred  fred       1388 May 31 07:31 .bash_history
d?????????  ? ?     ?            ?            ?   nfsdir