Backing up OpenVZ virtual machines with vzdump

Tuesday, August 4, 2009 posted by Till

Vzdump is a perl script that makes live backups of OpenVZ virtual machines very easy. The following steps are for Debian Linux but vzdump can be used on all other linux distributions. Only the installation may vary.

Download and install vzdump from http://download.openvz.org/contrib/utils/vzdump/

cd /tmp wget http://download.openvz.org/contrib/utils/vzdump/vzdump_1.1-2_all.deb dpkg -i vzdump_1.1-2_all.deb Create the backup directory <p class="command">mkdir /home/backup

Create a backup of all virtual machines as compressed (tar.gz) archive and send a email report to the root user when finished.

vzdump --dumpdir /home/backup --suspend --compress --mailto root --all

vzdump can also be used to restore a backup.  Example: restore the backup of the virtual machine 101:

vzdump --restore /home/backup/vzdump-101.tgz 101

To restore the backup to a different virtual machine, you can specify a differnt target ID. E.g. restore the backup of vm 101 to the virtual machine with the ID 500:

vzdump --restore /home/backup/vzdump-101.tgz 500

Share and Enjoy:
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Twitter
  • FriendFeed
  • MisterWong
  • StumbleUpon


Leave a Reply