Skip to content

Instantly share code, notes, and snippets.

@shaposhnikoff
Created October 12, 2025 18:58
Show Gist options
  • Select an option

  • Save shaposhnikoff/39a35e7d5831d0de9c56623581db384b to your computer and use it in GitHub Desktop.

Select an option

Save shaposhnikoff/39a35e7d5831d0de9c56623581db384b to your computer and use it in GitHub Desktop.
make fsteb entries fron showmount
#!/bin/bash
SERVER="192.168.10.211"
TMPFILE=$(mktemp)
showmount -e $SERVER > "$TMPFILE"
echo "# ==============================="
echo "# NFS mounts for $SERVER"
echo "# ==============================="
tail -n +2 "$TMPFILE" | while read -r line; do
EXPORT_PATH=$(echo "$line" | awk '{print $1}')
CLIENTS=$(echo "$line" | awk '{print $2}')
CLIENT_NET=$(echo "$CLIENTS" | cut -d'/' -f1)
MOUNT_NAME=$(echo "$EXPORT_PATH" | sed 's#/#_#g' | sed 's/^_//')
MOUNT_POINT="/mnt/${SERVER}_${MOUNT_NAME}"
echo "mkdir -p $MOUNT_POINT"
echo "${SERVER}:${EXPORT_PATH} ${MOUNT_POINT} nfs rw,sync,hard,intr,noatime,nofail 0 0"
echo
done
rm -f "$TMPFILE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment