Virtualization XSIBackup Lead image: Lead Image © urbanhearts,
Lead Image © urbanhearts,

Backup and replicate VMs on VMware ESXi

Clone Freedom

VMware ESXi virtualization is free, but it does not have a software tool to back up virtual servers. The free XSIBackup can help. By Thomas Joos

XSIBackup [1] does not require a graphical interface: It runs in the shell and offers everything administrators need to back up virtual servers, replicate running VMs on another host, and schedule data backups.


The tool should be installed, set up, and monitored on the ESXi host that will serve as a backup source. Additional servers or databases are not necessary. Either another ESXi server or a tethered network-attached server can serve as the backup target.

Virtual machines (VMs) can also be scheduled for replication on a different host using XSIBackup. The software sends a message by email on request about the status of the backup and any errors that occurred, including the results of a SMART test of the hard drives used. You configure the backup tool in the shell; once it is working, you do not need to manage it, because the tool runs in the background and does not generate load on the host until it backs up the VMs.

To configure XSIBackup, you need an SSH connection to the ESXi host. On Linux this is no problem; on Windows you can use the open source PuTTY [2] client. By default, SSH is disabled on the ESXi host.

To enable the service, connect to the host as the admin user with a vSphere client and select the Configuration tab (Figure 1). In the Software pane on the left, select the Security Profile link. You can enable the SSH service here. To do this, click Properties on the right side, then select SSH, and press Options. The Start and stop with host option is recommended. SSH is now enabled on both the source and the target host.

Before commissioning XSIBackup, you need to enable SSH on the host.
Figure 1: Before commissioning XSIBackup, you need to enable SSH on the host.

In the interest of a simple configuration, you will probably want to disable the firewall on the ESXi host temporarily via SSH:

esxcli network firewall unload

After installing, re-enable the firewall:

esxcli network firewall load

The backup is set up fairly quickly, so temporarily disabling the firewall should not cause any major security problems.

Setting Up the Source

To begin, you need to install XSIBackup on the host on which you want to replicate or back up the VMs. To do so, you can download the backup solution directly:

wget -O

For this to work on the ESXi host, you need a DNS server and default gateway in the host's network configuration. If this is not possible, or not desirable, you can manually download the XSIBackup ZIP file on another computer and then transfer it to the ESXi host. Generally, storing the tool in the data store holding the VMs that you want to back up is recommended. Then, use the following command

chmod 0700 xsibackup*

to unpack the archive and make it available to the root user only.

Target Host and Schedules

After preparing the source host, it's time to look at the target host on which the VMs you are replicating will be. First, create the connection between the source and target. To do so, run the following command as root in the shell of the source host:

./xsibackup --link-srv=<target_host_IP_address>

A message stating that you need to create a connection key is output, so you need to enter the root password here.

The XSIBackup scheduler on the source host automatically creates scheduled data backups. To install type the following:

./xsibackup --install-cron

Running this command the first time enables the scheduler. If you want to deactivate the function, use the --install-cron option again.

The xsibackup-cron file can hold many backup jobs with different options. For this to happen, add an XSIBackup command with the options you want in each line. To start the respective backup jobs based on a schedule, each line contains a --time option; for example:

xsibackup --time="Sun 19:00" --backup-point=/vmfs/volumes/backup --backup-type=running

This command backs up all running VMs on the host to the /vmfs/volumes/backup directory. The backup-type option here stipulates that XSIBackup backs up only active VMs. If you instead type --backup-type=all, XSIBackup also backs up disabled VMs to the target directory.

If you only want to replicate selected VMs, use the --backup-type=custom option. In this case, you also need the option --backup-vms=VM1,VM2,VM3, which defines which VMs you want XSIBackup to replicate. Additionally, you can define whether the backup solution should overwrite existing files or only add changed data to the files.

If want to transfer only the changed files, append :D to the path name:


If you want XSIBackup always to transfer all the data, the option is :F.

XSIBackup logs the completion of the different backup jobs in the xsibackup-cron.log file, and it can confirm execution of backup jobs by email.

The two options --on-success and --on-error let you automatically start a program for scheduled backups, depending on whether the backup was successful or not.

If a backup process freezes, you need to kill the process as root. The PID of the running XSIBackup process can be found in the xsibackup-pid file below the XSIBackup directory.

Testing and Optimizing

To discover whether XSIBackup is working, you can run an initial replication with the --test-mode=true option. You can thus verify the functionality of the backup setup without actually initiating a replication:

./xsibackup --backup-point=<path> --backup-type=running --test-mode=true

In addition to any errors and warnings, XSIBackup also shows the space required to replicate the VMs and the free disk space on the target host. If the target is a remote host, a simple path definition as the --backup-point will not work; instead, you need to specify the site like this:


It is also important to ensure that a connection is set up successfully in advance using

./xsibackup --link-srv=<target_host_IP>

Additionally, you can stipulate that XSIBackup store the various backups in separate subdirectories named for the date of the backup using the --date-dir=yes option. As already mentioned, the backup software can automatically send email with a status message. The settings for this are also configured through command-line options (Listing 1).

Listing 1: Email Options

./xsibackup --backup-point=/vmfs/volumes/backup --backup-type=running --mail-from=<sender> --mail-to=<receiver, comma-separated_list> --smtp-srv=<email server> --smtp-port=25 --smtp-usr=<login_name_on_server> --smtp-pwd=<password> --subject=<subject>

If the SMTP server requires a TLS connection, the --smtp-sec=TLS option is important. Moreover, you can add the SMART status of the ESXi host disks to the email report. To enabled it, use the --smart-info=yes option. For regular backups, the status should be added to the email report on at least one day of the week.

Backing Up on the Fly

XSIBackup offers several ways to customize the software to suit your individual needs. For example, the solution replicates VMs on the fly from the source to the target host by default; however, you have the option of switching off the virtual machines before the backup with the --backup-how=cold option. If you use this option, XSIBackup sends the command to shut down the VM and waits for 30 seconds. After that, the tool tests to see whether the shutdown was successful. If the VM is still running, XSIBackup waits another 30 seconds. If XSIBackup then determines that the VM has still not shut down, the backup tool kills the VM.

For this multistage process, the VMware tools must be installed on the virtual operating system. If the VMware tools are not available on the VM, XSIBackup will not even attempt a graceful shutdown but will immediately bring the virtual machine to a halt. This procedure is not recommended, because it can lead to data loss.


XSIBackup cannot replace a full backup of your virtual servers, but it can provide valuable assistance for replicating your most critical VMs to other hosts on the network or dumping backup copies on a network-attached server. After a failure of the source host, only minor adjustments are necessary to put the VMs back into operation on the target system.

XSIBackup is flexible in terms of controls, and scheduling helps you implement individual backup plans (Figure 2). The only option XSIBackup does not offer is a complete restore of the previously backed up files in the style of a classic backup tool.

The complete configuration of XSIBackup is handled in a shell on the ESXi host.
Figure 2: The complete configuration of XSIBackup is handled in a shell on the ESXi host.