VMware vSphere Hypervisor (ESXi) with Backup – Step by Step

VMware vSphere Hypervisor (ESXi) Installation



The plan is to use a simple and cheap Computer with two USB Flash Drive and a harddisk with lots of space to host one to three Windows VMware machines.

In our case we bought 15 Computers, 400 Euro each, 15 harddisks with 2 TB each for approx. 100 Euro each and 30 nano USB Flash Drive with 8GB for 7 Euro each.


Things you need to know

 We decided to use Nano USB Flash Drive because of the following reasons:

  • The filesystem is independent from the VMware Data Harddisks
    • Therefore we can easily exchange a broken Hostssystem
    • This is also the reason why there are 2 USB Flash Drive per Computer
    • It is cheap
    • (Speed: could be better if you used better USB Flash Drives. Nano Drives are a simple micro SD Card built-in in a nano USB card reader. And the speed of the micro SD Card is approximately equal to a single SATA-harddisk)

Usually I would recommend to change the Flash Drive after 5 years, but the vSphere Hypervisor does not write that much on the System Drive so you can use it theoretically much longer.

One of the worst things you could do edit files with Windows system tools.


I would recommend Notepad++ for Windows which can be downloaded here.

The thing is that Linux handles the <RETURN> different (r) than Windows (rn).


│   ├───backup.conf
│   └───vmware
│       └───firewall

Save the ghettoVCB.sh and the ghettoVCB-restore.sh in this directory:


the other files in


Do you prefer to get emailed when a backup finishes?

Open the ghettoVCB.sh file

There is a little fault in the script when it comes to saying HELO to the SMTP Server. In the script is

hostname -s

where we say HELO to. This is not correct, because we say HELO to the localhost instead to the SMTP Server.

change (line ~1088)

echo -ne "HELO $(hostname -s)rn" > "${EMAIL_LOG_HEADER}"



Do you prefer to get your emails over a Windows SMTP Server?

Open the ghettoVCB.sh file

The backupscript does not ask or try if it is a Windows or Linux SMTP Server. The problem which comes with the SMTP Server is similar to the text-editor problem: Windows uses Carriage Return Linefeed (<CR><LF>) and Linux just Carriage Return (<CR>).

Change (line ~1122)

                           "${NC_BIN}" -i "${EMAIL_DELAY_INTERVAL}" "${EMAIL_SERVER}" "${EMAIL_SERVER_PORT}" < "${EMAIL_LOG_CONTENT}" > /dev/null 2>&1


                           "${NC_BIN}" -C -i "${EMAIL_DELAY_INTERVAL}" "${EMAIL_SERVER}" "${EMAIL_SERVER_PORT}" < "${EMAIL_LOG_CONTENT}" > /dev/null 2>&1

You also need to open the built-in firewall for the Emails. This can be done be creating a custom firewall rule.

Create a textfile here:


with the following content:

  <service id='1000'>
    <rule id='0000'>



define your Backup Volume (datastore2 is available only if you have more than one harddisk)


Activate email log (if you prefer)


Email Server (I recommend the IP address instead of the SMTP server name because the name could not be resolved in every case such as network restrictions)


Email FROM (I recommend an suffix (VMB_) and the hostname as identifier)

EMAIL_FROM=VMB_`hostname –s`@sysstem.at

Email TO



Automatic Backup with cron

Create the file (no extension!)


with the following content (the first 4 lines are default by the vSphere Hypervisor, the 5th and last line is our custom line) Help about cron: Linuxhelp.net

#min hour day mon dow command
1 1 * * * /sbin/tmpwatch.py
1 * * * * /sbin/auto-backup.sh
0 * * * * /usr/lib/vmware/vmksummary/log-heartbeat.py
0 21 * * 0 /bin/ghettoVCB.sh -g /etc/backup.conf/ghettoVCB.conf -a

Computer preparation

Open the Computer install the 2TB harddrive (do not forget to connect a SATA and cable)

In my special case i had 6 (!) Windows partitions on the original harddrive. I needed to delete them before beginning with the installation, otherwise the vSphere Client would have problems adding the harddrive as datastore. Follow this tutorial if you have a similair situation.

Now plugin your USB Drive, and a keyboard (no mouse required) and a monitor.

Enter your BIOS/UEFI and change the boot priority to

  1. DVD
  2. SD/MMC (this should be the Nano USB)

all other is not needed and you can exclude it from boot order or place it anywhere past these two.

Another thing I did in the BIOS is to set the option: No halt on any errors. This will prevent the error

No Keyboard detectedPress F1 to resume

which makes a lot inexperienced users laugh. A computer (or server) needs to have a keyboard connected and after this error appears you can plugin a keyboard afterwards and press F1. But in my opinion we do not need to use a keyboard for this little servers. A powerplug and a networkcable is all we need.

Install the vSphere Hypervisor (ESXi)

Now the computer and the software is prepared we can install our servers.

  • Burn the predownloaded vSphere Hypervisor ISO to a disk (CD or DVD does not matter)
  • Boot the new server with it.
  • Accept the Terms of Condition (TOC)
  • Accept the EULA (End User Licence Agreement) with F11
  • Select the drive (in our case the SD/MMC Card) you want your vSphere Hypervisor to install to
  • Select a keyboard-layout of your choice
  • give a root password (choose a complex one, we add a user with a easier password to work with later)
  • Hit F11 to install
  • After the installation hit enter for reboot (the CD slot automatically opens, remove the CD)
  • Start the Computer, the screen of the vSphere Hypervisor appears
  • Hit F2 to make your preferences
  • I suggest to enter a fixed ip address aswell your DNS Servers

You are done with the configuration on the computer.

Configuration via vSphere Client

Download the vSphere Client via http://yourserverip/ (Link on the Website) and of course install it.

Save this setup for your colleagues as they may also want to use it and do not have to download it again. You only need do download and install it once, and not for every VMware Hypervisor you install.

I recommend to change the language of the vSphere to english (if it is not your default). From the information found here  you only need to add the following line to your shortcut (do not forget the space before the dash -)

 -locale en_US

Start the vSphere Hypervisor and type in the IP or hostname of the server you defined. Login with root and your password you entered before.

Enter your license key for unlimited use (there are some restrictions but it’s free!)

Add your harddiskdrives (or solidstatedrives) as new storages. I name them datastore 1-x because i have no use for these names and internally it is also named like this.

Now we add a new user with a new role, because we do not want to work with our VMs as root.

Go from home to Roles (Or Press [CTRL]+[SHIFT]+[R])

Add a new role with the following permissions

Confirm with OK and go back to the Inventory ([CTRL]+[SHIFT]+[H])

Go to local Users & Groups and make a right click then click add…

Give your user a login and also a strong password, but do not allow shell access because it should only be for the root user.

Go to Permissions and Add a Permission

In the window “Assign Permissions”

  • click Add…
  • select your user
  • click Add
  • click OK

Now assign the role you defined from the right column to your user and hit OK

Next step is to turn on SSH to get the prepared backupscript and other files onto the machine. Go to Configuration->Security Profile->Properties

Select SSH Server->Options…

Start the server with the button START but do NOT change the startup policy. It is not needed for this configuration.

Start WinSCP and PuTTY and enter your root credentials.


  • On your local filesystem navigate to your ESX folder (with the bin, etc and var folder within)
  • On the remote machine go to the /tmp folder.
  • copy the ESX folder to /tmp
In Putty
  • Change dir to /tmp with
cd /tmp
  • Make your backup-scripts executeable
chmod +x bin/ghettoVCB*
  • tarball and zip your files (stick together and compress. The filename must not exceed 12 characters. This is because of the 8.3 naming convention.)
tar -czvf sysstem.tgz bin/ etc/ var/
  • Verifiy if there were no errors
tar -tzvf sysstem.tgz
  • copy it to the bootbank
cp /tmp/sysstem.tgz /bootbank/
  • add your ‘module’ to the boot.cfg
sed -e '/modules=/s/$/ --- sysstem.tgz/' -i /bootbank/boot.cfg

Download the sysstem.tgz if you want to install more systems like this one.


For all further systems ONLY (skip this at the first system):

You just need to copy the sysstem.tgz to /bootbank in WinSCP and execute the following line in PuTTY

sed -e '/modules=/s/$/ --- sysstem.tgz/' -i /bootbank/boot.cfg


Shut your host down regularly over the vSphere Hypervisor so all your changes will be written to disk.

Now you are done with your VMware vSphere Hypervisor (ESXi).

In another article I will write about the migration from an old VMware host to the new vSphere Hypervisor and how to upgrade the host and also some more configuration such as the SSL Certificate and some other stuff.