User Tools

Site Tools


linux:arch_home_directories

Home Directories on Arch Linux

Client Config

Packages

Install Required Packages

pacman -S rpcbind nfs-utils nfsidmap

Configs

Change the lines in these files to the values defined.

/etc/idmapd.conf

Domain = acm.cs

/etc/conf.d/nfs-common

NEED_IDMAPD="yes"

/etc/fstab

172.29.0.6:/nfs-dir /mount-point nfs4 rw,hard,defaults 0 0

/etc/systemd/timesyncd.conf

[Time]
NTP=172.29.0.6 172.29.0.7
FallbackNTP=0.us.pool.ntp.org 1.us.pool.ntp.org 2.us.pool.ntp.org

Daemons

Two daemons need to be started after networking in order to mount NFS directories and one to keep things working right

  • rpcbind
  • nfs-common
  • systemd-timesyncd (timedatectl set-ntp true)

Start rpcbind then nfs-common, then you will be able to mount the nfs directories, add these entries to rc.conf in the daemons array after the network/net-profiles entries.

Server Config

Mozart is currently the NFS file server and is only accessible to members of the ACM LAN Admins group.

Exported directories are located in /export, this is the NFS root

Packages

Install Required Packages

pacman -S rpcbind nfs-utils nfsidmap openntpd

Configs

Change the lines in these files to the values defined.

The number of nfsd threads in increased from the default to improve preformance.

/etc/conf.d/nfs-server

# Number of servers to start up; the default is 8 servers.
NFSD_COUNT="32"
Configure the NTP server to sync against the US NTP pool and make sure that clients on the LAN have access

/etc/ntpd.conf

# sample ntpd configuration file, see ntpd.conf(5)

# Addresses to listen on (ntpd does not listen by default)
listen on 0.0.0.0

# sync to a single server
#server ntp.example.org

# use a random selection of NTP Pool Time Servers
# see http://support.ntp.org/bin/view/Servers/NTPPoolServers
servers us.pool.ntp.org

And finally this file controls the exporting of directories, and should have entries like these. To prevent issues with wildcards or IP ranges, each client has a separete config

/etc/exports

/export		172.29.0.0/24(rw,fsid=0,no_subtree_check,async,no_root_squash)
/export/path-to-acm-home-dirs 172.29.0.2(rw,no_subtree_check,async,nohide,no_root_squash)
/export/skel 172.29.0.2(ro,no_subtree_check,async,nohide,no_root_squash)

Daemons

Three daemons need to be started after networking in order to serve NFS directories and one to keep things working right

  • rpcbind.service
  • nfs-client.target
  • nfs-server.service
  • opennptd.service

Start rpcbind, then nfs-common, and then nfs-server, then you will be able to mount the nfs directories, add these entries to rc.conf in the daemons array after the network/net-profiles entries.

Enable the appropriate daemons via the systemd systemctl command

Moving /var/lib/nfs to tempfs

To increase server preformance and reduce the number of lockups on the NFS clients, especially since many are workstations, /var/lib/nfs, the home pf the nfsd rpcpipefs, to a tempfs directory aka to memory rather than disk. Add this daemon to the daemons line of rc.conf BEFORE nfs-common and nfs-server.

Add this line to the fstab

/etc/fstab

none /var/lib/nfs tmpfs defaults,mode=0755 0 0

Copy /var/lib/nfs to a separate directory called /var/lib/nfs.d then add these files to setup the systemd service.

/etc/systemd/system/nfsvartemp.service

[Unit]
Description=NFS Tempfs Setup
Before=nfsd.service

[Service]
Type=oneshot
ExecStart=/usr/local/sbin/nfsvartemp

[Install]
WantedBy=multi-user.target

/usr/local/sbin/nfsvartemp

#!/bin/bash
cp -R /var/lib/nfs.d/* /var/lib/nfs

Lastly

systemctl enable nfsvartemp.service
linux/arch_home_directories.txt · Last modified: 2016/12/02 12:21 by walter