summaryrefslogtreecommitdiffstats
path: root/nixos/doc/manual/configuration/nfs-file-systems.section.md
blob: 3ac6792e01679a118512c91aa663ec0c14f37026 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# NFS File Systems {#sec-nfs-file-systems}

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

[nfs]: https://en.wikipedia.org/wiki/Network_File_System
[nfs-man]: https://man7.org/linux/man-pages/man5/nfs.5.html

To mount NFS filesystems persistently, use the `fileSystems` option:

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

## Automounting {#sec-nfs-automount}

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

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

## Ad-hoc Mounting {#sec-nfs-adhoc}

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

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

Then you can mount filesystems manually:

```shell
$ sudo mount -t nfs server.example.com:/export/data /mnt/data
```

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