Backup of a running container with vzdump
Vzdump
Vzdump is an utility to make consistent snapshots of running OpenVZ VEs. It basically creates a tar archive of the VE private area, which also includes the VE configuration files.
There are several ways to provide consistency:
- Stop the VE during backup (very long downtime)
- Use rsync and suspend/resume (minimal downtime)
- Use LVM2 (no downtime)
Vzdump stores the backup on the disk in a single file. This file should go to a tape backup for archiving.
Download
Download vzdump rpm or deb packages from http://download.openvz.org/contrib/utils/vzdump/
For rpm based systems:
wget http://download.openvz.org/contrib/utils/vzdump/vzdump-0.3-1.noarch.rpm
For Debian based systems:
wget http://download.openvz.org/contrib/utils/vzdump/vzdump_0.3-1_all.deb
Installation
For rpm based systems:
rpm -i vzdump-0.3-1.noarch.rpm
For Debian based systems:
dpkg -i vzdump_0.3-1_all.deb
Synopsis
vzdump OPTIONS [--all â <VEID>] --compress compress dump file (gzip) --dumpdir DIR store resulting files in DIR --xdelta create a differential backup using xdelta --mailto EMAIL send notification mail to EMAIL --stop stop/start VPS if running --suspend suspend/resume VPS when running --snapshot use LVM snapshot when running --restore FILENAME restore FILENAME
Examples
Backup
Simply dump VE 777 - no snapshot, just archive the VE private area and configuration files to the default dump directory (usually /vz/dump/).
vzdump 777
Use rsync and suspend/resume to create a snapshot (minimal downtime).
vzdump --suspend 777
Backup all VEs and send notification mails to root.
vzdump --suspend --all --mailto root
Use LVM2 to create snapshots (no downtime).
vzdump --dumpdir /space/backup --snapshot 777
Restore
Restore above backup to VE 600
vzdump --restore /space/backup/vzdump-777.tar 600