I’ve created a shared folder like the following:
server ❯ sudo cat /etc/fstab
/run/media/user/X /srv/nfs/X none bind 0 0
server ❯ sudo mount -a
client ❯ sudo mkdir -p /data/nfs/X
client ❯ sudo cat /etc/systemd/system/data-nfs-X.mount
Description=Shared partition X
client ❯ sudo systemctl enable data-nfs-X.mount
client ❯ sudo cat /etc/systemd/system/data-nfs-X.automount
Description=Automount shared partition X
client ❯ sudo systemctl enable --now data-nfs-X.automount
client ❯ ls /data/nfs/X
ls: no se puede abrir el directorio '/data/nfs/X': No existe el dispositivo
client ❯ sudo mount -t nfs 192.168.1.122:/X /data/nfs/X
Why can I mount the folder manually but I can’t do it with systemd units?
I’ve never done anything with NFS, always had to use SAMBA, but I know you should:
- Not have anything mounted in
/run is volatile and not for permanent mounts. Rather use
/mnt, that’s what it’s there for.
- Don’t have any entries for the drive both in
/etc/fstab and a systemd unit for it. Choose 1 option only. I recommend systemd units. Mine works like an absolute charm.
- Rather use the IP address for the NFS share.
Hope it helps!
Do not do this. It will not always work as expected. Do not use
/run/ for anything expect USB thumb-drive you mount with via a GUI program.
Does not look like the same.
Do not enable it, if you want to use automount. Disable it, just enable the automount.
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.