Changes

Jump to navigation Jump to search
added chunk feature
Line 2: Line 2:     
=== Introduction ===
 
=== Introduction ===
 +
 
As of version 2, [[Affa]] supports hot backing up virtual machines running on the VMWare ESXi server. It uses the VMware Infrastructure Perl Toolkit to communicate with the EXSi and rsync over ssh to transfer the data. Before the backup starts, the state of the running VM is freezed by creating a snapshot of all its disks. After the freezed virtual disk files were backed up, the snapshot is deleted and the config points to the just backed up disks again. Then, as a last step the config files are backed up.
 
As of version 2, [[Affa]] supports hot backing up virtual machines running on the VMWare ESXi server. It uses the VMware Infrastructure Perl Toolkit to communicate with the EXSi and rsync over ssh to transfer the data. Before the backup starts, the state of the running VM is freezed by creating a snapshot of all its disks. After the freezed virtual disk files were backed up, the snapshot is deleted and the config points to the just backed up disks again. Then, as a last step the config files are backed up.
    
A restore of a VM can be done by simply copying back all archived files to the original location on the ESXi host. It is also possible to copy the files to a different directory (or to another ESXi server) and add the vmx file to the inventory.
 
A restore of a VM can be done by simply copying back all archived files to the original location on the ESXi host. It is also possible to copy the files to a different directory (or to another ESXi server) and add the vmx file to the inventory.
 +
 +
Latest Affa version is '''smeserver-affa-2.0.0-beta15'''
    
{{Note box|This document is applicable to ESX3i with an USB boot device. It will most likely not work with other type of boot devices}}
 
{{Note box|This document is applicable to ESX3i with an USB boot device. It will most likely not work with other type of boot devices}}
Line 60: Line 63:  
On ESXi the SSH service Dropbear is installed but disabled. To use rsync the SSH service must be enabled and the rsync program must be installed. To enable passwordless login a .ssh directory for storing the keys must be created.
 
On ESXi the SSH service Dropbear is installed but disabled. To use rsync the SSH service must be enabled and the rsync program must be installed. To enable passwordless login a .ssh directory for storing the keys must be created.
   −
A script is provided that does this:
+
A script <tt>affa-setup.sh</tt> is provided that does this:
 
* enable SSH service by configuring inetd.conf and restarting the inetd service
 
* enable SSH service by configuring inetd.conf and restarting the inetd service
 
* install rsync (statically linked binary)
 
* install rsync (statically linked binary)
Line 66: Line 69:  
* link the .ssh directory to the non-volatile USB device
 
* link the .ssh directory to the non-volatile USB device
 
* add a command to /etc/rc.local that executes all the steps above at boot time
 
* add a command to /etc/rc.local that executes all the steps above at boot time
<pre>
  −
# enable ssh service
  −
sed -ie 's/^#\(ssh.*\)/\1/' /etc/inetd.conf
  −
# reload inetd configuration
  −
kill -HUP `ps | grep inetd | sed -e 's/ .*//'`
  −
  −
# install rsync 3.0.4 statically linked
  −
cp -a /bootbank/bexi/rsync-static /bin/rsync
  −
  −
# root home dir for storing public keys
  −
mkdir -p /bootbank/bexi/root/.ssh
  −
touch /bootbank/bexi/root/.ssh/authorized_keys
  −
touch /bootbank/bexi/root/.ssh/known_hosts
  −
  −
# link .ssh dir to non-volatile USB location
  −
mkdir -p /root
  −
ln -fs /bootbank/bexi/root/.ssh /root/
  −
  −
# set new home dir for user root
  −
sed -ie 's#^\(root:.*\)\(:/:\)\(.*\)#\1:/root:\3#' /etc/passwd
  −
  −
# add execution of this script to rc.local
  −
grep -v "#BEXI$" < /etc/rc.local > /etc/rc.local.affa; mv -f /etc/rc.local.affa /etc/rc.local
  −
echo "test -f /bootbank/bexi/affa-setup.sh && /bootbank/bexi/affa-setup.sh #BEXI" >> /etc/rc.local
  −
echo "test ! -d /root && sed -ie 's#^\(root:.*\)\(:/root:\)\(.*\)#\1:/:\3#' /etc/passwd  #BEXI" >> /etc/rc.local
  −
</pre>
      
===== Download and install the script =====  
 
===== Download and install the script =====  
Line 132: Line 109:  
  'ESXiUsername' => 'affa',
 
  'ESXiUsername' => 'affa',
 
  'ESXiPassword' => 'secret',
 
  'ESXiPassword' => 'secret',
6. save the script, then run it
+
6. configure virtual disk files to be compressed and chunked
 +
'chunkFiles' => '*.vmdk',
 +
7. save the script, then run it
 
  /root/esxi-myvm-job.pl
 
  /root/esxi-myvm-job.pl
7. send the public key
+
8. send the public key
 
  affa --send-key esxi-myvm
 
  affa --send-key esxi-myvm
8. run the job manually
+
9. run the job manually
 
  affa --run esxi-myvm
 
  affa --run esxi-myvm
   Line 154: Line 133:     
=== Addtional Information ===
 
=== Addtional Information ===
 +
===== New properties in Affa 2 =====
 +
{| border="1" cellpadding="3" cellspacing=0
 +
|-
 +
| '''Property''' || '''Value''' || '''Default''' || '''Description'''
 +
|-
 +
| ESXi
 +
| yes ''or'' no || no || enable VMware ESXi virtual machine backup mode
 +
|-
 +
| ESXiVMName
 +
| string || || The name of the VM as displayed in the VI Client
 +
|-
 +
| ESXiUsername
 +
| string || || The name of the VI client with permission to created an delete snapshots
 +
|-
 +
| ESXiPassword
 +
| string || || The password of the user ESXiUsername
 +
|-
 +
| chunkFiles
 +
| string || || Filenames that Affa should chunk and compress. For ESXi set it to '*.vmdk' to chunk virtual disk files. Multiple file names are to be separated by the slash (/) character, e.g. 'mysql.dump/pgsql.dump' chunks the two files mysql.dump and pgsql.dump.
 +
|}
 +
===== New command line options in Affa 2 =====
 +
affa --unchunk-archive JOB ARCHIVE
 +
Concatenate and uncompress all chunked files in the archive ARCHIVE of job JOB to make the archive ready for a restore. Note that the most recent archive scheduled.0 is never chunked and therfore can be restored as it is without previous unchunking.
 +
 +
affa --chunk-archive JOB ARCHIVE
 +
Chunk and compress all files that match the names in property chunkFiles to save disk space. The should only be used as the reversal of --unchunk-archive. Chunks are stored as bzip2 files in a directory named FILENAME.affa-chunks with 8 depth levels.
 +
 
===== How to update the ESXi System Image =====
 
===== How to update the ESXi System Image =====
 
Shutdown the ESXi server. Remove the USB Memory stick and plug it into a linux computer.
 
Shutdown the ESXi server. Remove the USB Memory stick and plug it into a linux computer.
501

edits

Navigation menu