Linux NFS Operations: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
Line 12: Line 12:


=Mounting NFS Shares=
=Mounting NFS Shares=
mount -t nfs 10.10.2.131:/opt/nfs0 /mnt/nfs
where /opt/nfs0 is the share exposed by the NFS server.
A non-existent directory on the exported share cannot be mounted - the directory will not be created remotely upon mount. If /opt/nfs0/red directory does not exist, the following command will fail:
mount -t nfs 10.10.2.131:/opt/nfs0/red ./tmp/
mount.nfs: mounting 10.10.2.131:/opt/nfs0/red failed, reason given by server: No such file or directory
However, if the directory is created on the share, the mount succeeds:
ssh 10.10.2.131
sudo mkdir opt/nfs0/red
exit
mount -t nfs 10.10.2.131:/opt/nfs0/red ./tmp/


Also see: {{Internal|Linux_NFS_Configuration#Mount_Options|Mount Options}}
Also see: {{Internal|Linux_NFS_Configuration#Mount_Options|Mount Options}}

Latest revision as of 22:18, 17 December 2019

Internal

Export

Export without preventing access to the currently exported filesystems.

Add the new filesystem definition to /etc/exports or /etc/exports.d/*.exports and then:

exportfs -av

Mounting NFS Shares

mount -t nfs 10.10.2.131:/opt/nfs0 /mnt/nfs

where /opt/nfs0 is the share exposed by the NFS server.

A non-existent directory on the exported share cannot be mounted - the directory will not be created remotely upon mount. If /opt/nfs0/red directory does not exist, the following command will fail:

mount -t nfs 10.10.2.131:/opt/nfs0/red ./tmp/
mount.nfs: mounting 10.10.2.131:/opt/nfs0/red failed, reason given by server: No such file or directory

However, if the directory is created on the share, the mount succeeds:

ssh 10.10.2.131
sudo mkdir opt/nfs0/red
exit
mount -t nfs 10.10.2.131:/opt/nfs0/red ./tmp/

Also see:

Mount Options