Network filesystem

From Void Linux Wiki
Jump to: navigation, search

Here's a quick way to setup NFS on Void Linux.

Setting up a client (NFSv4, kerberos disabled)

To mount NFS shares (aka a client), a few simple steps must be done. To begin with, install the nfs-utils package:

# xbps-install -S nfs-utils

Next, start and enable the rpcbind service:

# ln -s /etc/sv/rpcbind /var/service

Now mount the share:

# mount -t nfs4 <host:/path/to/dir> /mnt/nfs/share

You can find out what shares a server is exporting with showmount -e <host>

Note: For NFSv2 or NFSv3 don't forget to also start/enable /etc/sv/statd.

Setting up a server (NFSv4, kerberos disabled)

If you are interested in the server, the first step is the same:

# xbps-install -S nfs-utils

Edit the /etc/exports file:

 # /etc/exports
 # See exports(5) for more information.
 # Use exportfs -r to reread
 # /export,no_root_squash)
 /storage/foo    *.local(rw,no_subtree_check,no_root_squash)

With this file we are exporting to any host in the local domain the /storage/foo directory as read/write. For information about what the other two options do, refer to exports(5).

Start and enable the required services:

# ln -s /etc/sv/rpcbind /var/service
# ln -s /etc/sv/statd /var/service
# ln -s /etc/sv/nfs-server /var/service

The shares should now be working. If that's not the case please check /var/log/messages (if using a syslog daemon). Use the showmount(8) utility to verify:

# showmount -e localhost