NFS Client: Difference between revisions

From NURDspace
Jump to navigation Jump to search
(Created page with "Using NFS on the NURDspace infrastructure Perform the following steps to get deterministic NFS behaviour on machines on the NURDspace network: 1) Install /usr/local/bin/manu...")
 
No edit summary
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
Using NFS on the NURDspace infrastructure
Perform the following steps to get deterministic NFS behaviour on machines on the NURDspace network:
Perform the following steps to get deterministic NFS behaviour on machines on the NURDspace network:


1) Install /usr/local/bin/manual-mount-nfs.sh with the following content:
* Install /usr/local/bin/manual-mount-nfs.sh with the following content:
<nowiki><pre>#!/bin/bash
<pre>#!/bin/bash


grep nfs /etc/fstab | grep noauto | while read FSTAB; do
grep nfs /etc/fstab | grep noauto | while read FSTAB; do
Line 14: Line 12:
     fi
     fi
     SHARE="$(echo "${FSTAB}" | awk '{ print $1 }')"
     SHARE="$(echo "${FSTAB}" | awk '{ print $1 }')"
     SERVER="$(echo "${SHARE}" | awk -F\: '{print $1}')"
     SERVER="$(echo "${SHARE}" | awk -F\: '{ print $1 }')"
     RMOUNT="$(echo "${SHARE}" | awk -F\: '{print $2}')"
     RMOUNT="$(echo "${SHARE}" | awk -F\: '{ print $2 }')"
    LMOUNT="$(echo "${FSTAB}" | awk '{ print $2 }')"
     echo -n "[+] Waiting for ${SERVER}: "
     echo -n "[+] Waiting for ${SERVER}: "
     while [[ -z "$(showmount -e "${SERVER}" | grep "^${RMOUNT}")" ]]; do
     while [[ -z "$(showmount -e "${SERVER}" | grep "^${RMOUNT}")" ]]; do
Line 24: Line 21:
     echo 'reachable'
     echo 'reachable'
     mount "${LMOUNT}"
     mount "${LMOUNT}"
done</pre></nowiki>
done</pre>


2) Make this script executable
* Make this script executable
3) Add this script to /etc/rc.local
* Add this script to /etc/rc.local
4) Add your mountpount to /etc/fstab, with the 'noauto' flag
* Add your mountpount to /etc/fstab, with the 'noauto' flag
5) Reboot
* Reboot

Latest revision as of 18:26, 11 July 2020

Perform the following steps to get deterministic NFS behaviour on machines on the NURDspace network:

  • Install /usr/local/bin/manual-mount-nfs.sh with the following content:
#!/bin/bash

grep nfs /etc/fstab | grep noauto | while read FSTAB; do
    LMOUNT="$(echo "${FSTAB}" | awk '{ print $2 }')"
    grep -q "${LMOUNT}" /etc/mtab
    if [[ ${?} -eq 0 ]]; then
	echo "[W] ${LMOUNT} already mounted, skipping..."
	continue
    fi
    SHARE="$(echo "${FSTAB}" | awk '{ print $1 }')"
    SERVER="$(echo "${SHARE}" | awk -F\: '{ print $1 }')"
    RMOUNT="$(echo "${SHARE}" | awk -F\: '{ print $2 }')"
    echo -n "[+] Waiting for ${SERVER}: "
    while [[ -z "$(showmount -e "${SERVER}" | grep "^${RMOUNT}")" ]]; do
	echo -n '.'
	sleep 1
    done
    echo 'reachable'
    mount "${LMOUNT}"
done
  • Make this script executable
  • Add this script to /etc/rc.local
  • Add your mountpount to /etc/fstab, with the 'noauto' flag
  • Reboot