Sample Header Ad - 728x90

Is /etc/auto.net right? Seems like a typo

0 votes
0 answers
115 views
Like many people I've had trouble with machines hanging when the NFSv3 server was not available (switched off). I saw various suggestions , like soft/hard , intr, bg etc being set... not a lot seems to work so I went back the the start. /etc/auto.net is a script run to determine what can be automatically mounted . Looking at the script it seemed pretty safe to run it just outputs a string. I have a NAS with the CNAME of "nas" (original I know): graeme@real:/etc$ MOUNT_NFS_DEFAULT_PROTOCOL=4 ./auto.net nas -fstype=nfs4,hard,intr,nodev,nosuid,async nas:/ graeme@real:/etc$ MOUNT_NFS_DEFAULT_PROTOCOL=3 ./auto.net nas \ /Download nas:/Download \ /InternalAdmin nas:/InternalAdmin \ /Multimedia nas:/Multimedia \ /Public nas:/Public \ /Recordings nas:/Recordings \ /USBUploads nas:/USBUploads \ /Web nas:/Web \ /git nas:/git \ /homes nas:/homes \ /svn nas:/svn As you see, for NFSv4 it outputs mount options followed by the NFSv4 export. For NFSv3 it just lists the exports (no options) if you look at the script however you see: SHOWMOUNT="$SMNT --no-headers -e $key" $SHOWMOUNT | LC_ALL=C cut -d' ' -f1 | LC_ALL=C sort -u | \ awk -v key="$key" -v opts="$opts" -- ' BEGIN { ORS=""; first=1 } { if (first) { print opts; first=0 }; print " \\\n\t" $1, key ":" $1 } END { if (!first) print "\n"; else exit 1 } ' | sed 's/#/\\#/g' opts="-fstype=nfs,hard,intr,nodev,nosuid" else # NFSv4 opts="-fstype=nfs4,hard,intr,nodev,nosuid,async" echo "$opts $key:/" fi The bit before the else is NFSv3 and the else is NFSv4...as you see NFSv4 sets opts then echos $opts then $key, Whereas NFSv3 sets opts in the same way **but then does not use it**. I wonder if assignment of opt was intended to be earlier, nowadays, preferably if the form: : ${opts:="-fstype=nfs,hard,intr,nodev,nosuid"} If I do this I get: graeme@real:/etc$ MOUNT_NFS_DEFAULT_PROTOCOL=3 /tmp/auto.net nas -fstype=nfs,hard,intr,nodev,nosuid \ /Download nas:/Download \ /InternalAdmin nas:/InternalAdmin \ /Multimedia nas:/Multimedia \ /Public nas:/Public \ /Recordings nas:/Recordings \ /USBUploads nas:/USBUploads \ /Web nas:/Web \ /git nas:/git \ /homes nas:/homes \ /svn nas:/svn
Asked by GraemeV (348 rep)
Nov 12, 2023, 12:55 PM