Digital Marketing

Mount an NFS Volume in Linux

# mount -t nfs nfs_volume local_dir options
# mount.nfs nfs_volume local_dir options

for example:

mount -t nfs /mnt/db2

If you have problem, you might need to mount nfs4 instead.

mount -t nfs4 /mnt/db2

If permission denied, edit the /etc/exports file, for example

/opt/docroot/,sync,no_root_squash) ⇒ range of networks NFS permits accesses
rw ⇒ writable
sync ⇒ synchronize
no_root_squash ⇒ enable root privilege
no_all_squash ⇒ enable users' authority

$ sudo systemctl restart  nfs.service
( OR $ service nfs restart )

If you get the following error:

mount.nfs: No such device

Try adding the option:  -o nolock

# mount -t nfs4 nfs_volume local_dir options  -o nolock

You can put it in /etc/fstab for auto mount when server restart:

Example: /var/www/html/  nfs  defaults        0 0

Mount it without restarting server by running:

$ sudo mount -a

See also:

How to fix: mount: wrong fs type, bad option, bad superblock

Also pay attention to your firewall setting.

$ sudo -i firewall-cmd --add-service=nfs --permanent
$ sudo -i firewall-cmd --reload

See also:

How to configure firewall on CentOS /Oracle Linux/ Red Hat 7

How to fix: NFS: rpc.nfsd: writing fd to kernel failed: errno 111 (Connection refused)

To test you can successfully connect to the NFS server:

$ telnet nfs
Connected to
Escape character is '^]'.

Connection closed by foreign host.

$ telnet 2049
Connected to

Escape character is '^]'.


Popular posts from this blog