Spent 20 minutes fighting with getting a Windows share to mount correctly in five of my vSphere (ESX4) hosts but it’s been working fine on the ESX 3.5 machines. This much work just to back up my VMs?
Fortunately, just figured out the differences.
First, how to mount your Windows shares on ESX 3.5:
Know where your Windows store is. Let’s say it lives at \\fileserver\backups in the Windows world. In Unix/Linux parlance, //fileserver/backups.
Domain Name: THECLOUD
Username with read/write permission on the share: backupsvc
Password for the backupsvc account: DoIt!
Create your mount point — I use /mnt/backups
Open outbound SMB firewall:
sudo esxcfg-firewall -e smbClient
Your /etc/fstab should have an entry that DOES NOT include a needed password to access your fileshare (anyone can read /etc/fstab!). So, you can use a credentials file with the right info and root can mount it. Let’s create the credentials file:
chmod 600 /root/.smbcredentials
sudo chown root:root /root/.smbcredentials
sudo vi /root/.smbcredentials
In the file, you need to have the right order and formatting:
username = backupsvc
password = DoIt!
Note the spaces. Save your changes then edit your /etc/fstab file and add:
//fileserver/backups /mnt/backups smbfs auto,credentials=/root/.smbpassword 0 0
Save the file, then see if it’ll mount your share with
Works great. But not on vSphere hosts. On those, you can’t use smbfs, you have to use cifs instead. And then, you’ll probably need to change your credentials file to new formatting and add a field.
So, the entry in /etc/fstab will need to look like this:
//fileserver/backups /mnt/backups cifs auto,credentials=/root/.smbpassword 0 0
And your /root/.smbpassword file will need to have:
Here, we need to add a domain entry (replace DOMAINNAME with the short name of your Windows domain) then remove the spaces from each line. Note, if your password includes a space, be sure to delimit the space with a backslash. Oh, and you don’t need to delimit a bang in the password. Found that out when I changed my password to WhatTheHell! when I was troubleshooting the constant Permission Denied errors while trying to mount my remote filesystem.
Good luck to ya!