Difference between revisions of "Backup of a running container with vzdump"
Martinmaurer (talk | contribs) m (updated to vzdump 1.1-1) |
Martinmaurer (talk | contribs) (Added links to new rpm´s, updated syntax) |
||
| Line 1: | Line 1: | ||
| − | Vzdump is a utility to make consistent snapshots of running OpenVZ containers. It basically creates a tar archive of the container's private area, which also includes the CT configuration files. | + | Vzdump is a utility to make consistent snapshots of running OpenVZ containers (and KVM virtual machines if you are using [http://pve.proxmox.com Proxmox VE]. It basically creates a tar archive of the container's private area, which also includes the CT configuration files. |
There are several ways to provide consistency: | There are several ways to provide consistency: | ||
| Line 13: | Line 13: | ||
For rpm based systems: | For rpm based systems: | ||
| − | <pre>wget http://www.proxmox.com/cms_proxmox/cms/upload/vzdump/vzdump-1. | + | <pre>wget http://www.proxmox.com/cms_proxmox/cms/upload/vzdump/vzdump-1.1-1.noarch.rpm</pre> |
For Debian based systems: | For Debian based systems: | ||
| Line 20: | Line 20: | ||
== Installation == | == Installation == | ||
For rpm based systems: | For rpm based systems: | ||
| − | <pre>rpm -i vzdump-1. | + | <pre>rpm -i vzdump-1.1-1.noarch.rpm</pre> |
For Debian based systems: | For Debian based systems: | ||
| Line 27: | Line 27: | ||
== Synopsis == | == Synopsis == | ||
| − | + | see also: | |
| + | <pre>man vzdump</pre> | ||
| + | |||
| + | vzdump OPTIONS [--all | <VMID>] | ||
| + | |||
| + | --exclude VPSID exclude VPSID (assumes --all) | ||
| + | --exclude-path REGEX exclude certain files/directories. You | ||
| + | can use this option more than once to specify | ||
| + | multiple exclude paths | ||
| + | --stdexcludes exclude temorary files and logs | ||
--compress compress dump file (gzip) | --compress compress dump file (gzip) | ||
--dumpdir DIR store resulting files in DIR | --dumpdir DIR store resulting files in DIR | ||
| − | -- | + | --tmpdir DIR store temporary files in DIR. --suspend and --stop are using this directory to store a copy of the VM. |
| − | --mailto EMAIL send notification mail to EMAIL | + | --mailto EMAIL send notification mail to EMAIL. You can use |
| − | --stop stop/start | + | this option more than once to specify multiple |
| − | --suspend suspend/resume | + | receivers |
| + | --stop stop/start VPS if running | ||
| + | --suspend suspend/resume VPS when running | ||
--snapshot use LVM snapshot when running | --snapshot use LVM snapshot when running | ||
| + | --size MB LVM snapshot size (default 1024) | ||
| + | --bwlimit KBPS limit I/O bandwidth; KBytes per second | ||
| + | --lockwait MINUTES maximal time to wait for the global | ||
| + | lock. vzdump uses a global lock file to make | ||
| + | sure that only one instance is running | ||
| + | (running sereral instance puts too much load | ||
| + | on a server). Default is 180 (3 hours). | ||
| + | --stopwait MINUTES maximal time to wait until a VM is stopped. | ||
--restore FILENAME restore FILENAME | --restore FILENAME restore FILENAME | ||
| − | + | ||
== Examples == | == Examples == | ||
Use a running container, for example install this: [[Proxmox Mail Gateway in container]]. | Use a running container, for example install this: [[Proxmox Mail Gateway in container]]. | ||
Revision as of 13:18, 26 November 2008
Vzdump is a utility to make consistent snapshots of running OpenVZ containers (and KVM virtual machines if you are using Proxmox VE. It basically creates a tar archive of the container's private area, which also includes the CT configuration files.
There are several ways to provide consistency:
- Stop the CT 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/ or for newest version, check http://www.proxmox.com/cms_proxmox/en/technology/oss-software/openvz/
For rpm based systems:
wget http://www.proxmox.com/cms_proxmox/cms/upload/vzdump/vzdump-1.1-1.noarch.rpm
For Debian based systems:
wget http://pve.proxmox.com/debian/dists/etch/pve/binary-amd64/vzdump_1.1-1_all.deb
Installation
For rpm based systems:
rpm -i vzdump-1.1-1.noarch.rpm
For Debian based systems:
dpkg -i vzdump_1.1-1_all.deb
Synopsis
see also:
man vzdump
vzdump OPTIONS [--all | <VMID>]
--exclude VPSID exclude VPSID (assumes --all)
--exclude-path REGEX exclude certain files/directories. You
can use this option more than once to specify
multiple exclude paths
--stdexcludes exclude temorary files and logs
--compress compress dump file (gzip)
--dumpdir DIR store resulting files in DIR
--tmpdir DIR store temporary files in DIR. --suspend and --stop are using this directory to store a copy of the VM.
--mailto EMAIL send notification mail to EMAIL. You can use
this option more than once to specify multiple
receivers
--stop stop/start VPS if running
--suspend suspend/resume VPS when running
--snapshot use LVM snapshot when running
--size MB LVM snapshot size (default 1024)
--bwlimit KBPS limit I/O bandwidth; KBytes per second
--lockwait MINUTES maximal time to wait for the global
lock. vzdump uses a global lock file to make
sure that only one instance is running
(running sereral instance puts too much load
on a server). Default is 180 (3 hours).
--stopwait MINUTES maximal time to wait until a VM is stopped.
--restore FILENAME restore FILENAME
Examples
Use a running container, for example install this: Proxmox Mail Gateway in container.
Backup
Simply dump CT 777 — no snapshot, just archive the container 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 containers and send notification mails to root.
vzdump --suspend --all --mailto root
Use LVM2 to create snapshots (no downtime).
vzdump --dumpdir /space/backup --snapshot 777
Note that using LVM2 and vzdump to create snapshots requires 512Mb of free space in your VG as described here.
Restore
Restore the above backup to CT 600:
vzdump --restore /space/backup/vzdump-777.tar 600
Bugs
(fixed in 1.1-1) vzdump will fail under Debian Etch in version 1.0-2 if it is invoked with parameter "--snapshot" and if the logical volume name contains a hyphen. One possible workaround is to rename the logical volume in question thus it doesn't contain any hyphen. A bug report was sent to proxmox on 02 June 2008. Other distributions or versions may be affected, too.