NFS File Systems

NFS (Network File System) allows you to mount directories from remote machines over the network.

To mount NFS filesystems persistently, use the fileSystems option:

{
fileSystems."/mnt/data" = {
device = "server.example.com:/export/data";
fsType = "nfs";
};
}

Automounting

To have NFS filesystems mounted on-demand instead of at boot, add the noauto and x-systemd.automount options:

{
fileSystems."/mnt/data" = {
device = "server.example.com:/export/data";
fsType = "nfs";
options = [
"noauto"
"x-systemd.automount"
];
};
}

Ad-hoc Mounting

To mount NFS filesystems ad-hoc using the mount command, enable NFS and required RPC services:

{
boot.supportedFilesystems = [ "nfs" ];
}

Then you can mount filesystems manually:

Terminal window
$ sudo mount -t nfs server.example.com:/export/data /mnt/data

For more information on NFS mount options, see the nfs(5) man page.