Posted on March 24, 2014 · Posted in VMWare

Free backup of virtual machines VMWare ESXi using MKSBackup

To automatically backup virtual machines on VMWare ESXi host, we are going to use a free tool MKSBackup that can be downloaded here (by the time the article was written, the latest available version of MKSBackup was 1.0.4 as of 24.01. 2013). This tool is a sort of a front end integrated with different backup scripts, including GhettoVCB (a VM backup script written on perl and supported by enthusiasts). GhettoVCB allows to backup running virtual machines online. A VM backup is created by making its snapshot.

Important. GhettoVCB does not work with virtual machines having snapshots. To backup a virtual machine all snapshots should be deleted (e. g. using Snapshot Manager).

MKSBackup is one of a few backup tools that allows to perform online backups of running virtual machines. MKSBackup can be used to back up virtual machines running both proprietary versions of VMware ESXi or free VMware Hypervisor. The tool is developed on Python and is a cross-platform utility and doesn’t have a graphic interface, runs from the command line and can be configured via configuration files.

It’s obvious that the convenience and manageability of the MKSBackup solution for VMWare virtual machines is less than the proprietary products suggest, but it is compensated by being free, simple to configure and deployment speed.

MKSBackup Script Installation

  1. Download the MKSBackup archive and extract it.
  2. Run mksbackup.exe. A simple console installation wizard is started. During the installation you have to specify the directory to which the script is installed (by default, C:\Magik), the necessity to install ghettoVCB script (yes), the name of the backup task (you can do it later) and the user password to run the backup task (can be done later).install mksbackup in Windows

Configure Backup Settings of the ESXi Virtual Machines

The next step is to configure the backup settings of the virtual machines running on ESXi. The configuration is basically the editing of mksbackup.ini config file (by default it is located in C:\Magik).

Open mksbackup.ini in any text editor. This file consists of several sections, and the name of each section is enclosed inside square brackets.


This section allows to set e-mail notification options. We don’t need them, so we leave:


The next section is [VMWARE_FROM_WINDOWS]. This section allows to set backup options and describes different settings running the virtual machine backup in Windows. In our sample the task looks like that:









vm_list=vm1 winXP


scp_bin="C:\Tools\Putty\pscp.exe" -scp -r


vmware virtual machine backup settings

Let’s consider the task settings in more detail:

program – a backup program, we leave ghettovcb

host – a name/IP of the ESXi host, on which virtual machines are running

port – an access port (by default, port 22 — SSH protocol)

login – a name of the user having access rights to the ESXi server (by default, it is root, but for the reasons of safety it’s better to create a separate user on the ESXi server)

password – a user password

local – the local directory, where a backup script and its configuration is stored

global_conf – a file containing ghettoVCB settings

vm_list – a list of virtual machines subject to backup. If you need to back up all virtual machines, leave this setting empty. If you have to exclude some VMs, use the vm_exclude parameter.

destination – this option allows to specify the type of an operation. It can be

  • backup – performs a simple backup (you don’t have to specify destination)
  • copy – performs a backup and copies the backup files into the specified folder
  • move – performs a backup and moves the backup files into the specified folder

Let’s dwell on move as the optimum option. In this case local backups of virtual machines are created on the ESXi host, then they are moved to the computer that has run the script.

mon-sun – it is assumed that the script can be run daily (let’s leave it as it is, because we set the backup interval in the Windows Task Scheduler).

In addition, specify the folder, to which VM backups will be moved (C:\magik). The ${vm}parameter shows that each virtual machine will get a separate directory with the name of this machine to store the backup files.

Note. A detailed description of configuration settings of the script and its synax is given on the developer web site.

scp_bin – a path to scp utility

Tip. A modified scp utility is a part of Putty package and is called pscp.exe. Download the archive with Putty and extract it into any folder (in our sample it is C:\Tools\Putty\).   

Important. Make sure that the SSH is enabled on the ESXi server.

Then it is necessary to make some changes to ghettoVCB.conf (in our example it is located in C:\magik\vmware). We need the following options:



VM_BACKUP_VOLUME is the directory on the ESXi server where virtual machine backups will be stored (it’s obvious that VMFS should have enough free space)

VM_BACKUP_ROTATION_COUNT is a number of stored local copies (in our example the latest 3 copies will be stored)

Now you have to save a host key in the local SSH cache with the plink utility (a part of Putty package). E. g., like that:

PLINK.EXE root@ ls /

pklink save ssh host key

Starting backup of virtual machines on the VMWare ESXi

Let’s test the backup script. To do it, open the command line with administrator privileges and run the command:

C:\Magik\MKSBackup\mksbackup.exe -v -c C:\Magik\mksbackup.ini backup VMWARE_FROM_WINDOWS

,where –v shows that verbose information is displayed, -c specifies the path to the configuration file mksbackup.ini, backup means that backup should be run, at the end a name of the task from mksbackup.ini (in our sample it is VMWARE_FROM_WINDOWS) is indicated.

run backup vmware virtual machines script from Windows

If everything is configured correctly, the tool starts to display verbose information about the backup progress in the console (the backup process is quite time consuming, so it wouldn’t end quickly).

The backup progress can be tracked by appearing/deleting snapshots in VMware vSphere console.

backup vmware machines through snapshots

During script execution the folders containing virtual machine files will appear in the destination directory.

After test backup you can proceed with automatic backup. To do it, create a new task in the Windows Task Scheduler.

Create a task with the name «Backup ESXi», which is performed on Friday and runs the command: C:\Magik\MKSBackup\mksbackup.exe -v -c C:\Magik\mksbackup.ini backup VMWARE_FROM_WINDOWS

Don’t forget to specify that the task should be run with administrator rights («Run with highest privileges») in the task options.

backup vm at vmware esxi windows task sheduller

Note. If the task is run under any other account (not the one that performed the testing), you have to remember that the cache of the new account doesn’t have the necessary key. To solve the problem, run the command plink described above from the new account.

The disadvantages of this method of virtual machines backup are:

  • rather low speed of backup
  • much free space necessary to store VM backups

These disadvantages are compensated by the fact that it is free, but it’s better to use paid backup products for larger solutions, like Veeam or HP DataProtector.

Related Articles