Connect to a NFS Share with Gentoo

Install NFSv4

The below command will install with the default USE flags of ipv6, tpcd and nfsv4.

emerge --ask nfs-utils

Find NFS Shares

If you don’t know or can remember the name of your NFS shared drives, you can use the below command to list the exports.

storm ~ # showmount -e "192.168.111.200"
Export list for 192.168.111.200:
/personal shared
/Web
/Usb
/Recordings
/Public
/Network Recycle Bin 1
/Multimedia
/Download
storm ~ #

I want to connect to “/personal shared“, but note the space in the share name.

mount -t nfs "192.168.111.200:/personal shared" ~/nfs/

To mount a share like this you will need to encase it in double quotes.

If you get a message like this…

mount.nfs: rpc.statd is not running but is required for remote locking.
mount.nfs: Either use '-o nolock' to keep locks local, or start statd.
mount.nfs: an incorrect mount option was specified

…you need to start the statd daemon.

storm ~ # /etc/init.d/rpc.statd start
 * Caching service dependencies ...                                                                                                                               [ ok ]
 * Starting rpcbind ...                                                                                                                                           [ ok ]
 * Starting NFS statd ...                                                                                                                                         [ ok ]
storm ~ #

To make this change permanent, you need to add statd and other NFS related daemons to the default runlevel.

rc-update add nfsmount default

You should not be able to run the above mount command even after a reboot. To un-mount.

umount -v ~/nfs

Auto-Mount NFS Shares

Now to auto-mount, provided nfsmount is on the default runlevel, you just need to add an entry to your /etc/fstab file.

192.168.111.200:personal\040shared     /root/nfs     nfs      rw,_netdev,auto,sync    0 0

Note the \040\ where the space should be in “personal shared“. Using double quotes or the like does not appear to work in fstab.

References

Gentoo Wiki – NFSv4
http://wiki.gentoo.org/wiki/NFSv4

Be the first to comment

Leave a Reply