Print this Page

Home Server NFS4 Shares

Index.

 

Introduction.

File sharing for Linux or *BSD clients is best done with NFS. Currently NFS version 4 is wide supported so that is what we will setup. On our Linux client, the mgmtws system, disks from the homsrv machine will be mounted. Everything is configured for IPv4 only, it seems that there are some missing pieces to use NFS via IPv6. Right now this isn’t a big problem for our network.

 

Configure the server.

First, install nfs-utils on the Home Server:

[root@homsrv ~]# pacman -S nfs-utils
resolving dependencies...
looking for inter-conflicts...

Targets (7): libgssglue-0.1-4  libtirpc-0.2.1-3  rpcbind-0.2.0-3
             librpcsecgss-0.19-5  nfsidmap-0.24-2  libevent-2.0.11-1
             nfs-utils-1.2.3-2

Total Download Size:    0.79 MB
Total Installed Size:   3.77 MB

Proceed with installation? [Y/n]
:: Retrieving packages from core...
 libgssglue-0.1-4-i686    32.9K  201.3K/s 00:00:00 [######################] 100%
 libtirpc-0.2.1-3-i686   176.0K  583.7K/s 00:00:00 [######################] 100%
 rpcbind-0.2.0-3-i686     27.8K  245.6K/s 00:00:00 [######################] 100%
 librpcsecgss-0.19-...    49.7K  297.5K/s 00:00:00 [######################] 100%
 nfsidmap-0.24-2-i686     33.0K  202.6K/s 00:00:00 [######################] 100%
 libevent-2.0.11-1-i686  285.5K  714.7K/s 00:00:00 [######################] 100%
 nfs-utils-1.2.3-2-i686  206.1K  611.6K/s 00:00:00 [######################] 100%
(7/7) checking package integrity                   [######################] 100%
(7/7) checking for file conflicts                  [######################] 100%
(1/7) installing libgssglue                        [######################] 100%
(2/7) installing libtirpc                          [######################] 100%
(3/7) installing rpcbind                           [######################] 100%
(4/7) installing librpcsecgss                      [######################] 100%
(5/7) installing nfsidmap                          [######################] 100%
(6/7) installing libevent                          [######################] 100%
(7/7) installing nfs-utils                         [######################] 100%
 ==> PLEASE NOTE:
 ==> Extended configuration options for NFS (clients & server) are available in
 ==> /etc/conf.d/nfs-common.conf and in /etc/conf.d/nfs-server.conf
 ==>
 ==> Please refer to http://wiki.archlinux.org/index.php/Nfs
 ==> for further information on NFS; for NFSv4, refer to
 ==> http://wiki.archlinux.org/index.php/NFSv4  
[root@homsrv ~]#

Edit /etc/exports to add two filesystems we want to make available for client machines:

# /etc/exports
#
# List of directories exported to NFS clients.  See exports(5).
# Use exportfs -arv to reread.
#
# Example for NFSv2 and NFSv3:
#  /srv/home       hostname1(rw,sync) hostname2(ro,sync)
#
# Example for NFSv4:
#  /srv/nfs4       hostname1(rw,sync,fsid=0)
#  /srv/nfs4/home   hostname1(rw,sync,nohide)
# Using Kerberos and integrity checking:
#  /srv/nfs4        gss/krb5i(rw,sync,fsid=0,crossmnt)
#  /srv/nfs4/home   gss/krb5i(rw,sync,nohide)
#
/home        10.126.160.0/24(rw,sync,no_root_squash,no_subtree_check)
/mnt/users   10.126.160.0/24(rw,sync,no_root_squash,no_subtree_check)

Then edit /etc/idmapd.conf to set our domain in it:

[General]

Verbosity = 0
Pipefs-Directory = /var/lib/nfs/rpc_pipefs
Domain = wpl.ym

[Mapping]

Nobody-User = nobody
Nobody-Group = nobody

[Translation]

Method = nsswitch

Make sure the next line is in /etc/hosts.allow (libwrap support will be dropped soon):

ALL: ALL

Now start the NFS services:

[root@homsrv etc]# /etc/rc.d/nfs-common start
:: Starting rpcbind                                                      [DONE]
:: Starting rpc.statd daemon                                             [DONE]
:: Mounting pipefs filesystem                                            [DONE]
:: Starting rpc.idmapd daemon                                            [DONE]
[root@homsrv etc]# /etc/rc.d/nfs-server start
:: Mounting nfsd filesystem                                              [DONE]
:: Exporting all directories                                             [DONE]
:: Starting rpc.nfsd daemon                                              [DONE]
:: Starting rpc.mountd daemon                                            [DONE]
[root@homsrv etc]#

Add these services to /etc/rc.conf in the DAEMONS=() line, it might now ook like:

DAEMONS=(syslog-ng acpid network netfs sshd crond named nfs-common nfs-server \
         iptables ip6tables dhcp4 dhcp6 radvd ntpd)

 

Configure the client.

To configure the client, just install nfs-utils like above and edit /etc/idmapd.conf so that the wpl.ym domain is set in there. You now only need to start nfs-common and add that to /etc/rc.conf. The add the following lines to /etc/fstab:

#
# nfs
#
homsrv.wpl.ym:/mnt/users  /mnt/users  nfs4    defaults            0      0
homsrv.wpl.ym:/home       /mnt/home   nfs4    defaults            0      0

Make sure you have the mountpoints /mnt/users and /mnt/home, execute “mount -a” and then you should have these two new filesystems mounted from the Home Server.

 

Download.

The configuration and scripts for this article:

Linux Home Server complete package
Linux Home Server complete package
homeserver-complete.tar.gz
2.6 MiB
7 Downloads
Details...

Permanent link to this article: http://www.mbse.eu/linux/homeserver/essential/nfsserver/