Host: Mount NFS share on Host

Storage & Share · Host~6 minView script

Mount an external NFS export (from a NAS, another server, a homelab share…) on the Proxmox host. Pick one or both methods: register it as Proxmox storage (visible in Datacenter > Storage) and/or add a plain /etc/fstab mount at a path you choose (useful for bind-mounting the share into LXC containers without exposing it as a Proxmox storage).

What this does

ProxMenux offers two mount methods for any NFS export: (1) Proxmox storage via pvesm add nfs — the share shows up in Datacenter > Storage and Proxmox manages the mount at /mnt/pve/<id>; (2) Host fstab mount at a path you pick — persistent via /etc/fstab, NOT visible as Proxmox storage, ideal for bind-mounting to LXC containers (Proxmox UI stays clean). You can run one method, the other, or both.

Opening the tool

From ProxMenux's main menu, open Storage & Share Manager → Add NFS share as Proxmox Storage. You will see this sub-menu with four options (plus Exit):

NFS Host Manager menu — Mount / View / Remove / Test connectivity

How the script runs

The flow has two phases with clear separation between "discovering, validating and choosing" and "actually mounting / writing config". After selecting an export, you pick mount method(s) via a checklist; the rest of the dialogs only ask for params for the methods you selected. Until the final confirmation, neither /etc/pve/storage.cfg nor /etc/fstab are touched.

┌─────────────────────────────────────────────┐
│  PHASE 1 — Discover, validate, choose       │
│  (nothing touched yet)                      │
└──────────────────┬──────────────────────────┘
                   ▼
      Dependency check
      └─ nfs-common present? (showmount)
         If missing → apt-get install nfs-common
                   │
                   ▼
      Server selection
      ├─ Auto-discover  (nmap -p 2049 on /24)
      └─ Manual         (type IP or hostname)
                   │
                   ▼
      Reachability + showmount validation
                   │
                   ▼
      Export selection
                   │
                   ▼
      ╔═════════════════════════════════════╗
      ║   MOUNT METHOD PICKER  (checklist)  ║
      ║   [ ] As Proxmox storage  (pvesm)   ║
      ║   [ ] As host fstab mount only      ║
      ║   (mark one or both — re-prompts    ║
      ║    if you press OK without marks)   ║
      ╚════════════════╤════════════════════╝
                       │
        ┌──────────────┴──────────────┐
        ▼                             ▼
   pvesm branch                  fstab branch
   ├─ storage ID                 ├─ mount path
   ├─ content types              └─ mount options
   ▼                             ▼
   ┌─────────────────────────────────────────┐
   │  PHASE 2 — Apply (only marked methods)  │
   └──────────────────┬──────────────────────┘
                      ▼
   pvesm add nfs <id> ...    +  mkdir -p <path>
   (auto-mount at            mount -t nfs ...
    /mnt/pve/<id>)           append /etc/fstab
                             systemctl daemon-reload
                             chmod 1777 + setfacl
                             (best-effort, NFS server-side)
                      ▼
              Summary printed

Mount method picker (two options, mark one or both)

After selecting and validating the export, ProxMenux shows a checklist with the two mount methods. You can mark either, or both. If you press OK without marking anything, the dialog re-appears until you choose at least one option or press Cancel to exit the flow.

MethodMount pathVisible in Datacenter > StorageTypical use case
As Proxmox storage (pvesm)/mnt/pve/<storage-id> (managed by Proxmox)YesVM disk images, backups, ISOs, LXC templates — anything that needs to appear in the Proxmox UI.
Host fstab only/mnt/<path> (you pick the path)NoBind-mounting the share into one or more LXCs without exposing it as a Proxmox storage. Keeps the Datacenter UI clean.
BothBoth paths above (two mount points for the same NFS export)YesUI integration plus a separate stable host path with open permissions for LXC bind mounts.

"Both" creates two independent NFS mounts

Both methods run separately: pvesm mounts at /mnt/pve/<id> and fstab at /mnt/<path>. This provides a Proxmox-managed mount with default options and a separate host mount for LXC bind mounts. Two mount points do not guarantee two separate TCP connections; the NFS client may reuse transport connections.

Method A — As Proxmox storage (pvesm)

If As Proxmox storage is marked, ProxMenux runs the original pvesm flow:

  1. Storage ID — what Proxmox will call this storage. Default is nfs-<server-ip-with-dashes>. Only letters, digits, - and _ are accepted.
  2. Content types — Proxmox ties content categories to storage volumes; pick what this NFS is allowed to hold:
Content typeWhat it allows
importDisk image imports (selected by default). Needed for Import Disk Image to VM.
backupVM and CT backup files (vzdump).
isoInstallation ISO images.
vztmplLXC templates.
imagesLive VM disk images (this turns the NFS into a VM disk store).
rootdirLXC root filesystems (rare for NFS — read the note below).
snippetsHook scripts and cloud-init snippets.

images and rootdir on NFS

Selecting images lets Proxmox store VM disks on NFS. Performance depends on the network, server and workload; an outage can block I/O that depends on the mount. Selecting rootdir stores LXC root filesystems on NFS, where unprivileged containers can encounter UID mapping, overlay and ownership limitations. Assess these requirements before placing images / rootdir there; NFS is also useful for backup / iso / vztmpl.

The result is pvesm add nfs <id> --server <srv> --export <path> --content <csv> and Proxmox auto-mounts at /mnt/pve/<id>.

Method B — Host fstab mount only

If As host fstab mount only is marked, ProxMenux asks for a host mount path and persistent options, then mounts and writes the entry to /etc/fstab:

  1. Host mount path — default /mnt/<export-basename>. Must be an absolute path. If something is already mounted there, or a fstab entry exists for the same path, ProxMenux warns you and offers to replace it.
  2. Mount options — pick Read/Write (default with rw,hard,nofail,_netdev,rsize=131072,wsize=131072,timeo=600,retrans=2), Read-only, or Custom (type your own option string).

Once you confirm, the script:

  • mkdir -p the mount path.
  • mount -t nfs -o <opts> <srv>:<export> <path>.
  • Writes a one-line entry to /etc/fstab: <srv>:<export> <path> nfs <opts> 0 0.
  • Runs systemctl daemon-reload so systemd picks up the new fstab entry.
  • Attempts chmod 1777 + setfacl o::rwx on the mount point (silent best-effort — only succeeds if the NFS server allows it; many NAS exports already serve world-writable paths).

Using the fstab mount from an LXC

The script prints a pct set command for a bind mount, e.g. pct set <ctid> -mp0 /mnt/<path>,mp=/mnt/<ct-path>,shared=1,backup=0. Or use the LXC Mount Manager, which detects fstab mounts. No changes are made inside the container. Access from an unprivileged CT depends on server-side permissions for its mapped UIDs/GIDs. The script only attempts host-side permission changes; it cannot guarantee writable exports or manufacturer defaults. See Troubleshooting if access fails.

The fstab mount is NOT a Proxmox storage

The host fstab mount is invisible to the Proxmox web UI — by design. It does not appear in Datacenter > Storage, you cannot select it in the VM / CT creator, and Proxmox backup jobs cannot target it. It is purely a host filesystem path. If you also want UI integration, mark both methods in the picker.

Manual equivalent

Method A (pvesm) maps to:

apt-get install -y nfs-common    # one-time: NFS client tools
pvesm add nfs mynfs \
  --server 10.0.0.50 \
  --export /export/proxmox \
  --content import,backup,iso

pvesm status mynfs                # verify it's active
ls -la /mnt/pve/mynfs              # Proxmox auto-mounts here

Method B (fstab) maps to:

apt-get install -y nfs-common    # one-time

mkdir -p /mnt/data
mount -t nfs -o "rw,hard,nofail,_netdev,rsize=131072,wsize=131072,timeo=600,retrans=2" \
      10.0.0.50:/export/proxmox /mnt/data

# Persist
echo "10.0.0.50:/export/proxmox /mnt/data nfs rw,hard,nofail,_netdev,rsize=131072,wsize=131072,timeo=600,retrans=2 0 0" \
  >> /etc/fstab
systemctl daemon-reload

# Best-effort open perms for LXC bind-mount writes (server permitting)
chmod 1777 /mnt/data 2>/dev/null || true
setfacl -m o::rwx /mnt/data 2>/dev/null || true

# Bind into an unprivileged LXC (host-side perms only — no changes inside CT)
pct set <ctid> -mp0 /mnt/data,mp=/mnt/data,shared=1,backup=0
pct reboot <ctid>

View configured NFS storages

Lists the NFS storages registered in Proxmox (pvesm status | awk '$2 == "nfs"') with server, export, content types, mount path and live status, followed by the host's /etc/fstab NFS mounts with server, export, path, options and whether each is mounted.

Remove NFS storage

The picker lists both Proxmox storages ([pvesm]) and host fstab mounts ([fstab]). For a Proxmox storage it runs pvesm remove <storage-id> after a confirmation that shows the server / export / content. For an fstab mount it unmounts the path, backs up /etc/fstab to /etc/fstab.proxmenux.bak, removes the line and deletes the mount directory if it is empty. The remote NFS server itself is never touched, no files are deleted.

Back up dependencies first

If VMs, CTs or backup jobs still reference this storage (by ID), removing it leaves them pointing at a disappeared store. Proxmox will flag the error but not clean up. Move or drop those references first, then remove the storage.

Test NFS connectivity

Runs a diagnostic pass over every NFS storage registered in Proxmox and every NFS mount in the host's /etc/fstab: checks that showmount is available, that rpcbind is running, pings each server, probes port 2049, calls showmount -e, and finally reports Proxmox's own view (pvesm status). Good first stop when a storage shows as inactive in the Proxmox UI.

Troubleshooting

"No NFS servers found on the network"

Auto-discover uses nmap -p 2049 --open <subnet>/24. The server may not respond if: it is on a different VLAN / subnet, its firewall blocks nmap probes (many do) or port 2049 is intentionally closed on that interface. Use the Manual option with the server's IP or hostname instead.

"NFS port (2049) is not accessible"

Ping succeeded but nc -z -w 3 <server> 2049 failed. Check the NFS service is running on the server (systemctl status nfs-server on Linux, Control Panel → File Services on Synology, NFS plugin on OMV / TrueNAS), and that the firewall allows 2049 from the Proxmox host.

"Failed to connect" from showmount

The server refused the export-list query. Common causes: the server enforces strict client ACLs (your Proxmox IP is not on the allowed list), rpcbind is not running on the server, or the server exposes only NFSv4 with showmount disabled. The export path can still be added manually if you know it.

Storage shows as inactive in the Proxmox UI

Run Test NFS Connectivity first: it checks that the server answers ping, that port 2049 is open and that the export list (showmount -e) is available. If connectivity works but storage remains inactive, inspect journalctl -u pvestatd and the server/export configuration. Restore the underlying connectivity or permissions first. pvesm set <id> --disable 0 enables a disabled storage; it is not a general repair for NFS failures.

fstab mount works but unprivileged LXC can't write through a bind-mount

NFS access depends on server-side ownership, ACLs and squash settings. CIFS-style options such as uid= and file_mode= do not apply to NFS. With default LXC mapping, CT root becomes host UID 100000, not remote UID 0. Configure access for the actual mapped UID/GID or the server’s anonymous identity. no_root_squash only affects remote UID 0, so it is not a universal fix for UID 100000. The script attempts chmod 1777 but cannot override the server’s permissions.

fstab mount does not come up after reboot

The script adds nofail,_netdev so a missing share at boot does not block startup. If the mount never comes up: confirm the network is reachable (ping <server>), check journalctl -u remote-fs.target, and verify the entry is valid with mount -fav | grep nfs. mount -a after boot mounts everything that is currently missing.

Related