Manage Learn to apply best practices and optimize your operations.

Automatically Mount Windows Shares

Setting up Windows Share (SMB Share) to be mounted when ESX first boots

This came up from the VMware Forums. Someone want to have a Windows Share (SMB Share) mounted when ESX first booted.

It’s worth saying that this is not recommended by VMware, as it puts additional burden on the Service Console – unless its done properly – it can also introduce a potential security weakness as well.

If the SMB Share is unavailable at boot-up it does not stall the ESX host or produce any [Failed] error message during the boot process - as long as if it is correctly configured.

A quick thank you to Michael Knight who drew my attention to netfs.

With these caveats in mind – here is how its done.

1. Setting up your Windows Shares

Many people set-up their vmimages locally – in this case I am making /vmimages point to a network location.

1. Share a folder on Windows Machine
2. Logon to the Service Console as ROOT
3. Type:

nano -w /etc/fstab

4. At the end of the file type:

//instructor/vmimages /vmimages smbfs username=administrator,password=Password1 0 0

//instructor/vmimages is the name of my server and the sources is the folder I shared. /sources will be the name of our mounting point. Smbfs is tells the system to use the SMB protocol. I used the administrator account to gain access. Noauto means X, and 0 0 means do not do a file system check or memory dump/cache

Confirm you have name resolution to the Windows Server by ping it. If you get time outs review your DNS or /etc/hosts settings

5. Save the File and Exit nano
6. Then mount the /vmimages location with

mount /vmimages

Test you can create a file in this location – if not review your permissions

7. To see the files use cd /vmimages and ls -l to list them

The definition in the mount point in fstab will survive reboots – but you will have to use mount /vmimages at the Service Console to view the files themselves.

If you are using Windows 2003 – you might find you get this error

SMB Error

This is caused by the introduction of “security signing” of SMB packets as a default (this was optional in Windows 2000). The Service Console implementation of SAMBA does not support this. The only solution is to lower the security of the file server to which you are trying to connect to. Using the Windows Policy system (make sure you use the right one! There are many!)

Computer Configuration \ Windows Settings \ Security Settings \ Local Policies \ Security Options

Locate the policy called “Microsoft network server: Digitally sign communications (always)”

Choose © Disabled

This issue is outlined in the MS KB Article 823659

2. Enable netfs
NetFS is a file system interface to the networking components of an operating system. Read more here

  1. Logon to the Service Console as ROOT
  2. Type:chkconfig netfs on

The process is now complete. Do a test reboot to confirm that it works!

If you concerned about the security issues then this article gives you good overview

Dig Deeper on Scripting administrative tasks

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.