How to enable NFS in Arch Linux
Enable NTP
First check if your NTP is enabled by doing a timedatectl
command:
$ timedatectl
Local time: Sat 2021-02-13 11:16:22 CST
Universal time: Sat 2021-02-13 17:16:22 UTC
RTC time: Sat 2021-02-13 17:16:20
Time zone: America/Chicago (CST, -0600)
System clock synchronized: no
NTP service: inactive
RTC in local TZ: no
In the example above you’ll see that system clock is not synchronized and NTP service is disabled. You can enable it by this command.
$ sudo timedatectl set-ntp true
$ sudo hwclock --systohc
After enabling, your timedatectl
should look something like this:
$ timedatectl
Local time: Sat 2021-02-13 11:26:11 CST
Universal time: Sat 2021-02-13 17:26:11 UTC
RTC time: Sat 2021-02-13 17:26:11
Time zone: America/Chicago (CST, -0600)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no
Make sure to enable this to the rest of the clients who will connect to the NFS server.
Install NFS Utils
In Arch Linux, you will need to install nfs-utils
. This is done via pacman using the following command:
$ sudo pacman -S nfs-utils
Update exports file
NFS is configured by a file called /etc/exports
. You can use any text editor you like.
$ sudo vim /etc/exports
To share a file, the syntax is <folder name> <ip>(<options>)
. Here is an example that will share myawesomefolder
to the entire network. Relace *
to a specific IP address if you want:
/home/myuser/myawesomefolder *(rw,sync)
Apply the changes by doing a exportfs
command.
$ sudo exportfs -rav
Enable the NFS service
$ sudo systemctl enable --now nfs-server
Verify shared exports
In the client, you can verify the shared folders via showmount
command.
$ showmount -e 192.168.1.101
Export list for 192.168.1.101:
/home/myuser/myawesomefolder *
Create the mounting directory
The shared folder will need a target directory. Create the new directory via mkdir
command:
$ mkdir myawesomefolder
$ ls
myawsomefolder
$
Mount the shared folder
$ sudo mount -t nfs 192.168.1.101:/home/myuser/myawesomefolder myawesomefolder
Created symlink /run/systemd/system/remote-fs.target.wants/rpc-statd.service → /usr/lib/systemd/system/rpc-statd.service.