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.

[/tab] [/accordion] 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

Download the MKSBackup archive and extract it.

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).

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. Section:

1

[DEFAULT]

[DEFAULT]

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

1

mail=no

mail=no

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:

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:

,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.

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.

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.

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.