Lead Image © urbanhearts, fotolia.com

Lead Image © urbanhearts, fotolia.com

Backup and replicate VMs on VMware ESXi

Clone Freedom

Article from ADMIN 33/2016
By
VMware ESXi virtualization is free, but it does not have a software tool to back up virtual servers. The free XSIBackup can help.

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.

Installation

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.

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 http://33hops.com/downloads/?f=xsibackup.zip -O xsibackup.zip

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:

--backup-point="192.168.100.100:22:/vmfs/volumes/hp-test:D"

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.

Buy ADMIN Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Back up virtual machines and clusters
    Vembu BDR Suite provides comprehensive software that supports flexible configuration when backing up virtual production operations.
  • Using rsync for Backups

    Although commercial Linux backup tools are available, many people prefer open source to better understand and control the backup process. One open source tool that can do both full and incremental backups is rsync.

  • Simplify integration of S3 storage with local resources
    The AWS hybrid storage service, known as the Storage Gateway, provides local applications with a seamless connection to Amazon S3 storage. We explain the different gateway types and guide you through their setup.
  • ESXi ransomware attacks
    Files encrypted by ransomware have been the nightmare scenario of IT departments, and even specialized operating systems like the ESXi server are not immune. We look at how to mitigate risk and prepare for recovery if hypervisor protection fails.
  • Disaster recovery for Windows servers
    Need to fix a Windows server? We'll discuss some techniques for getting your system back. You'll also learn some tricks for Active Directory and Exchange.
comments powered by Disqus
Subscribe to our ADMIN Newsletters
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs



Support Our Work

ADMIN content is made possible with support from readers like you. Please consider contributing when you've found an article to be beneficial.

Learn More”>
	</a>

<hr>		    
			</div>
		    		</div>

		<div class=