This shows you the differences between two versions of the page.
linux:arch_home_directories [2016/12/02 18:21] walter [Configs] |
linux:arch_home_directories [2021/05/02 21:36] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Home Directories on Arch Linux ====== | ||
- | ====== Client Config ====== | ||
- | |||
- | ===== Packages ===== | ||
- | |||
- | Install Required Packages | ||
- | <code> | ||
- | pacman -S rpcbind nfs-utils nfsidmap | ||
- | </code> | ||
- | |||
- | ===== Configs ===== | ||
- | |||
- | Change the lines in these files to the values defined. | ||
- | |||
- | |||
- | <file|/etc/idmapd.conf> | ||
- | Domain = acm.cs | ||
- | </file> | ||
- | <file|/etc/conf.d/nfs-common> | ||
- | NEED_IDMAPD="yes" | ||
- | </file> | ||
- | <file|/etc/fstab> | ||
- | 172.29.0.6:/nfs-dir /mount-point nfs4 rw,hard,defaults 0 0 | ||
- | </file> | ||
- | <file|/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 | ||
- | </file> | ||
- | |||
- | |||
- | ===== 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 | ||
- | <code> | ||
- | pacman -S rpcbind nfs-utils nfsidmap openntpd | ||
- | </code> | ||
- | |||
- | ===== Configs ===== | ||
- | |||
- | Change the lines in these files to the values defined. | ||
- | |||
- | |||
- | The number of nfsd threads in increased from the default to improve preformance. | ||
- | <file|/etc/conf.d/nfs-server> | ||
- | # Number of servers to start up; the default is 8 servers. | ||
- | NFSD_COUNT="32" | ||
- | </file> | ||
- | Configure the NTP server to sync against the US NTP pool and make sure that clients on the LAN have access | ||
- | <file|/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 | ||
- | </file> | ||
- | |||
- | 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 | ||
- | <file|/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) | ||
- | </file> | ||
- | |||
- | ===== 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 | ||
- | <file| /etc/fstab> | ||
- | none /var/lib/nfs tmpfs defaults,mode=0755 0 0 | ||
- | </file> | ||
- | |||
- | Copy /var/lib/nfs to a separate directory called /var/lib/nfs.d then add these files to setup the systemd service. | ||
- | |||
- | <file|/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 | ||
- | |||
- | </file> | ||
- | |||
- | <file|/usr/local/sbin/nfsvartemp> | ||
- | #!/bin/bash | ||
- | cp -R /var/lib/nfs.d/* /var/lib/nfs | ||
- | </file> | ||
- | |||
- | Lastly | ||
- | <code> | ||
- | systemctl enable nfsvartemp.service | ||
- | </code> |