Skip to content

Instantly share code, notes, and snippets.

@gjpalau
Created February 11, 2015 20:21
Show Gist options
  • Save gjpalau/2ef477c73ac093b7bffd to your computer and use it in GitHub Desktop.
Save gjpalau/2ef477c73ac093b7bffd to your computer and use it in GitHub Desktop.
nfs mount script
#!/bin/sh
# NFS Auto-Mount for Mavericks/Yosemite
# Scripted by Gilbert Palau
# November 2014 v1.0
#
FILE_DATE=`date +%Y%m%d`
if [ -f /etc/auto_master ]; then
sudo mv /etc/auto_master /etc/auto_master_backup-$FILE_DATE
fi
echo "# Automounter master map" > /etc/auto_master
echo "+auto_master # Use directory service" >> /etc/auto_master
echo "/net -hosts -nobrowse,hidefromfinder,nosuid" >> /etc/auto_master
echo "/home auto_home -nobrowse,hidefromfinder" >> /etc/auto_master
echo "/Network/Servers -fstab" >> /etc/auto_master
echo "/- -static" >> /etc/auto_master
echo "/- auto_netapp -browser,nosuid" >> /etc/auto_master
echo "/-" >> /etc/auto_master
chown root:wheel /etc/auto_master && chmod 644 /etc/auto_master && chown root:wheel /etc/auto_netapp && chmod 644 /etc/auto_netapp
if [ -f /etc/auto_netapp ]; then
sudo mv /etc/auto_netapp /etc/auto_netapp_backup-$FILE_DATE
fi
echo "/NetApp_Share/FileShare -fstype=nfs,tcp,vers=3,sec=sys,rw,rsize=65536,wsize=65536 nfs://netapp-ntap01:/vol/nfs_share1" > /etc/auto_netapp
sudo mkdir -p /NetApp_Share/FileShare
chmod -R 777 /NetApp_Share
sleep 1
sudo automount -vc
sudo defaults write com.apple.desktopservices DSDontWriteNetworkStores true
if [ -f ~/Desktop/FileShare ]; then
sudo rm -f ~/Desktop/FileShare
fi
sudo ln -s /NetApp_Share/FileShare ~/Desktop/FileShare
sudo chmod 777 ~/Desktop/FileShare
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment