A. Mikkelsen VMware ESX scripts, commands, tools and other nice to know things that will make your virtualization days easier!!!!

Wednesday, February 28, 2007

Mounting NAS / NFS share on ESX 3.0

Filed under: Scripting — A. Mikkelsen @ 21:01 pm

If you want to mount a NAS / NFS share in ESX 3.0, then you are not given the option to choose a username and password.
This presented me with a small challange because i needed to mount /vmimages/vmiso/ to a share on a W2K3 server.

SoI created this small script, that mounts /vmimages/vmiso/ to a NFS share on a W2K3 server.
The script is intented to run as part of the Service Console’s startup routine.
I have implemented a simpel log feature, that logs the date and time the script is run and any errors if any.

Create a file S99mount with the following content: (Download it here)

echo “****************************************” >> /tmp/mount.log
date >> /tmp/mount.log
sleep 30
echo “Start the mount” >> /tmp/mount.log
mount -t smbfs -o username=myusername,password=mypassword //myservername/myshare /vmimages/vmiso/ >> /tmp/mount.log
echo ” ” >> /tmp/mount.log

Copy the file to /etc/rc3.d/
Make the file executable
chmod 777 /etc/rc3.d/S99mount
Create the directory vmiso under /vmimages/
mkdir /vmimages/vmiso
Change the firewall to allow outbound traffic for the SMB Client
esxcfg-firewall –enableService smbClient

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress