The advantages to this method are that you don't need to configure backups for every virtual machine, and you don't need to worry about bare-metal recovery of these machines. The first disadvantage is that it performs a full backup of each virtual server every night, unless you have a backup that can perform subfile incrementals. The only open-source product that may be able to do that is rdiff-backup. The second disadvantage is that it requires suspending virtual machines, which renders them unusable during the backup. This downtime may be undesirable in many environments.
|Tip: One way to have your cake and eat it too is if your virtual machines are residing on an LVM (Logical Volume Manager) volume that supports snapshots. You could suspend all the virtual machines, take an LVM snapshot, and then unsuspend the virtual machines. This minimizes the amount of time the virtual machine is suspended but allows you to take as long as you need to back up the LVM snapshot.|
To suspend a running machine from the command line, run the following command, where the .vmx file is the configuration file stored in the virtual machine directory:
C:> vmware-cmd path-to-config/config.vmx suspend
You can now back up the virtual
C:> vmware-cmd path-to-config/config.vmx start
|Tip: If you use ESX Server, your backup tools may have trouble accessing the VMFS files. Make sure you test any new backup method.|
Copy/export a running virtual machine using VMware's tools (ESX only)
Finally, if you're running VMware ESX Server, you can use the Perl APIs to copy the virtual machine files while the machine is running. The Perl APIs create a snapshot of the changes that happen to the virtual machine during the backup, storing them in a redo log, then copying or exporting the virtual files to another location. This method has the same advantages mentioned for the previous method, and it comes with the additional advantage of being able to back up systems while they're running.
This process requires using ever-changing Perl scripts, so we won't cover implementation details here. The VMware Web site includes example scripts. There's also an open-source tool called vmbk, written by Massimiliano Daneri, that can automate this process. Learn more about it at www.vmts.net/vmbk.htm.
This was first published in June 2007