#!/bin/bash # Make the NAS mount boot-proof on one node, keeping the protocol that works there. # # Used on dgx1/2/3/4/8 on 2026-11-11 (phase 1 of flare-storage-nas.md). # # ./set-nas-mount-opts.sh [remount yes|no] # ./set-nas-mount-opts.sh 4.1 # dgx2, dgx3, dgx4, dgx8 # ./set-nas-mount-opts.sh 4.0 no # dgx1 (4.1 hangs there; live mount was fine) # # Why a script and not a sed over the nas.lan:/sna line: the protocol version lives # in that same line, so a blanket rewrite silently forces 4.1 onto nodes that cannot # mount it (dgx1 hangs on a fresh 4.1 mount, with one clean client and nconnect=1). # The entry is rewritten by its mount-point field instead. # # Note: `nofail` never appears in live mount options (it is an fstab/systemd # option), so verify the applied change with `timeo=100`, not with `nofail`. set -e export LC_ALL=C VERS="${1:?usage: $0 [remount yes|no]}" REMOUNT="${2:-yes}" sudo cp -a /etc/fstab "/etc/fstab.bak-$(date +%F-%H%M)" sudo python3 - "$VERS" <<'PY' import sys vers = sys.argv[1] path, out, hit = "/etc/fstab", [], False for line in open(path).read().splitlines(True): f = line.split() if len(f) >= 3 and f[1] == "/mnt/nas": opts = ("rw,hard,nofail,x-systemd.mount-timeout=30,rsize=1048576,wsize=1048576," "timeo=100,retrans=3,noatime,nodiratime,actimeo=600,nconnect=8,vers=" + vers) out.append("nas.lan:/sna\t/mnt/nas\tnfs4\t%s\t0\t0\n" % opts) hit = True else: out.append(line) assert hit, "no /mnt/nas entry in fstab" open(path, "w").write("".join(out)) PY grep "/mnt/nas" /etc/fstab sudo systemctl daemon-reload if [ "$REMOUNT" = yes ]; then # A plain umount (never -l): it fails safely when something holds the mount, and # it is the only thing that actually clears stale NFS client IDs. if sudo umount /mnt/nas 2>/dev/null; then echo "umount ok"; else echo "umount skipped (busy?)"; fi timeout 40 sudo mount /mnt/nas && echo "mount ok" fi findmnt -no OPTIONS /mnt/nas | grep -qo 'timeo=100' \ && echo "VERIFIED timeo=100 live" \ || echo "NOT live yet (fstab only; takes effect on next mount)"