Backup OpenVZ container with vzdump

Vzdump is a tool to backup and restore OpenVZ container. Download vzdump source from here, for details we can see in http://download.openvz.org/contrib/utils/vzdump/.

install VZdumpd
ependency packages:

  • cstream
  • perl(LockFile::Simple)

install repo-forge

rpm -ivh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpm

install dependencies

yum install cstream perl-LockFile-Simple

install vzdump

rpm -ivh vzdump-1.2-4.noarch.rpm

How to backup OpenVZ container

Check the container ID

[root@jos penyet]# vzlist
CTID NPROC STATUS IP_ADDR HOSTNAME
101 95 running 175.xx.xx.xx example.banjarnahor.com
102 33 running 175.xx.xx.xx smtp.banjarnahor.com
103 42 running 175.xx.xx.xx vzdump.banjarnahor.com
104 37 running 175.xx.xx.xx banjarnahor.com

In example the container has ID 103 and backup,

[root@jos penyet]# vzdump --compress --suspend 103
INFO: starting new backup job: vzdump --compress --suspend 103
INFO: Starting Backup of VM 103 (openvz)
...
INFO: Finished Backup of VM 103 (00:02:22)
INFO: Backup job finished successfuly

Tips:
Sometimes we got this error.

Mar 19 13:22:57 ERROR: Backup of VM 103 failed - command 'rsync --stats -x --numeric-ids --bwlimit=10240 -aH --delete --no-whole-file --inplace '/vz/private/103/' '/vz/
dump/vzdump-openvz-103-2015_03_19-13_08_28.tmp'' failed with exit code 23

Just stop the container

[root@jos penyet]# vzctl stop 103
Stopping container ...
Container was stopped
Unmounting file system at /vz/root/103
Unmounting device /dev/ploop41685
Container is unmounted

and backup again

[root@jos penyet]# vzdump --compress --suspend 103

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>