Free, Simple and Fast backup of VMWare ESXi 5.x Virtual Servers

The free version of VMware ESXi still lacks a decent way of backing up virtual machines. You need to purchase a license for that feature. There's a simple new tool available that will allow you to perform backups of multiple live vm's and more.

There are some third party options, but most are difficult to setup and many don´t work on esxi. You can configure and use ghettovcb.sh, but that is no straight forward. I´ve been using mksbackup which worked fine in ESXi 4.x but transfer speed via ftp were poor. Additionally, in ESXi 5.x the ftpput utility is missing and MKSBackup still relies on ghettovcb and also requires you to upload ftpput to your server.

The author of mksbackup, Alain Spineux has developed a new tool that does away with the need for ghettovcb.sh, ftpput and all that configuration. It´s called bazaarvcb and is a single executable for Windows and Linux that lets you make backups and even restore them with a simple command-line tool.

Here is a sample script that can backup all vm's on a specific server. It's also configured to use gmail for those who don't have access to a smtp server. It's fully commented so it's really easy to modify without resorting to the man pages.


@echo off
REM vmname  -the name or the .vmx path
set vms=ubuntusrv1,ubuntusrv2,windowsserver1,web01

REM host options:
REM -H HOST, --host HOST hostname or ip address of the ESXi server
set esxihost=192.168.0.10
REM -P PORT, --port PORT  port
REM -u USER, --user username
set user=root
REM -p PASSWORD, --password PASSWORD password
set pass=password

REM --roll-out COUNT the number of backup to keep, 0 to never roll, greater than 0 to roll before to backup
set rollout=3
REM --disk-format {zeroedthick,eagerzeroedthick,thin,2gbsparse} only for remote backup, when vmkfstools is used, default is to keep the same format
set diskformat=zeroedthick

REM mail options:
REM --mail {always,never,error} when to send an email, default is never
set mailsend=error
REM --mail-host HOST -name or IP of the mail relay
set mailhost=smtp.gmail.com
REM --mail-port PORT -tcp port of the mail relay, (default depend of mode)
set mailport=587
REM --mail-mode {normal,ssl,tls} S-MTP protocol
set mailmode=tls
REM --mail-login LOGIN -login for the mail relay
set maillogin=sender@gmail.com
REM --mail-password PASS -password for the mail relay
set mailpassword=password
REM --mail-sender SENDER -email address of the sender
set mailsender=sender@gmail.com
REM --mail-recipient RECIPIENT -email address of one recipient, you can use multiple option
set mailrecipient=recipient@gmail.com
REM --mail-header HEADER -email address of one recipient, you can use multiple option

REM target   local or remote directory where to backup the VM
set backuptarget=C:\backup

for %%V in (%vms%) do bazaarvcb.exe backup -H %esxihost% -u %user% -p %pass% --hashing --roll-out %rollout% --mail %mailsend% --mail-host %mailhost% --mail-port %mailport% --mail-mode %mailmode% --mail-login %maillogin% --mail-password %mailpassword% --mail-sender %mailsender% --mail-recipient %mailrecipient% --mail-header "Backup error %%V" --disk-format %diskformat% %%V %backuptarget%\%%V\

2 comments:

  1. worx gr8 with powershell & get-vm to build input file

    ReplyDelete
  2. How to use multiple option for mailrecipient?

    ReplyDelete