Backup utility for virtual machine
vzdump \s-1OPTIONS\s0 [--all | <\s-1VMID\s0>]
--exclude \s-1VMID\s0 exclude \s-1VMID\s0 (assumes --all)
--exclude-path \s-1REGEX\s0 exclude certain files/directories. You
can use this option more than once to specify multiple exclude paths
--stdexcludes exclude temporary files and logs
--compress compress dump file (gzip)
--storage \s-1STORAGE_ID\s0 store resulting files to \s-1STORAGE_ID\s0 (\s-1PVE\s0 only)
--script execute hook script
--dumpdir \s-1DIR\s0 store resulting files in \s-1DIR\s0
--maxfiles N maximal number of backup files per \s-1VM\s0.
--tmpdir \s-1DIR\s0 store temporary files in \s-1DIR\s0. --suspend and --stop
are using this directory to store a copy of the \s-1VM\s0.
--mailto \s-1EMAIL\s0 send notification mail to \s-1EMAIL\s0. You can use
this option more than once to specify multiple receivers
--stop stop/start \s-1VM\s0 if running
--suspend suspend/resume \s-1VM\s0 when running
--snapshot use \s-1LVM\s0 snapshot when running
--size \s-1MB\s0 \s-1LVM\s0 snapshot size (default 1024)
--bwlimit \s-1KBPS\s0 limit I/O bandwidth; KBytes per second
--lockwait \s-1MINUTES\s0 maximal time to wait for the global
lock. vzdump uses a global lock file to make sure that only one instance is running (running several instance puts too much load on a server). Default is 180 (3 hours).
--stopwait \s-1MINUTES\s0 maximal time to wait until a \s-1VM\s0 is stopped.
vzdump is an utility to make consistent snapshots of running virtual machines (VMs). It basically creates a tar archive of the \s-1VM\s0 private area, which also includes the \s-1VM\s0 configuration files. vzdump currently supports OpenVZ and QemuServer VMs.
There are several ways to provide consistency: Stop the \s-1VM\s0 during backup. This results in a very long downtime. For OpenVZ, this mode uses rsync to copy the \s-1VM\s0 to a temporary location (see option --tmpdir). Then the \s-1VM\s0 is suspended and a second rsync copies changed files. After that, the \s-1VM\s0 is started (resume) again. This results in a minimal downtime, but needs additional space to hold the \s-1VM\s0 copy. For QemuServer, this mode work like \*(C`stop\*(C' mode, but uses suspend/resume instead of stop/start. This mode uses \s-1LVM2\s0 snapshots. There is no downtime, but snapshot mode needs \s-1LVM2\s0 and some free space on the corresponding volume group to create the \s-1LVM\s0 snapshot.
Newer version of vzdump encodes the virtual machine type and the backup time into the filename, for example
vzdump-openvz-105-2009_10_09-11_04_43.tar
That way it is possible to store several backup into the same directory. The parameter \*(C`maxfiles\*(C' can be used to specify the maximal number of backups to keep.
The resulting tar files can be restored with the following programs.
For details see the corresponding manual pages.
Global configuration is stored in /etc/vzdump.conf.
tmpdir: DIR dumpdir: DIR storage: STORAGE_ID mode: snapshot|suspend|stop bwlimit: KBPS lockwait: MINUTES stopwait: MINUTES size: MB maxfiles: N script: FILENAME
You can specify a hook script with option \*(C`--script\*(C'. This script is called at various phases of the backup process, with parameters accordingly set. You can find an example in the documentation directory (\*(C`hook-script.pl\*(C').
vzdump skips the following files wit option --stdexcludes
/var/log/.+ /tmp/.+ /var/tmp/.+ /var/run/.+pid
You can manually specify exclude paths, for example:
> vzdump --exclude-path \*(C`/tmp/.+\*(C' --exclude-path \*(C`/var/tmp/.+\*(C' 777
(only excludes tmp directories)
Configuration files are also stored inside the backup archive (/etc/vzdump), and will be correctly restored.
VZDump does not save ACLs.
Simply dump \s-1VM\s0 777 - no snapshot, just archive the \s-1VM\s0 private area and configuration files to the default dump directory (usually /vz/dump/).
> vzdump 777
Use rsync and suspend/resume to create an snapshot (minimal downtime).
> vzdump --suspend 777
Backup all VMs and send notification mails to root.
> vzdump --suspend --all --mailto root
Use \s-1LVM2\s0 to create snapshots (no downtime).
> vzdump --dumpdir /mnt/backup --snapshot 777
Backup all VMs excluding \s-1VM\s0 101 and 102
> vzdump --suspend --exclude 101 --exclude 102
Restore an OpenVZ machine to \s-1VM\s0 600
> vzrestore /mnt/backup/vzdump-openvz-777.tar 600
Restore an Qemu/KVM machine to \s-1VM\s0 601
> qmrestore /mnt/backup/vzdump-qemu-888.tar 601
vzrestore(1) qmrestore(1)
Dietmar Maurer <[email protected]>
Many thanks to Proxmox Server Solutions (www.proxmox.com) for sponsoring this work.
Copyright (C) 2007-2009 Proxmox Server Solutions GmbH
Copyright: vzdump is under \s-1GNU\s0 \s-1GPL\s0, the \s-1GNU\s0 General Public License.
This program is free software; you can redistribute it and/or modify it under the terms of the \s-1GNU\s0 General Public License as published by the Free Software Foundation; version 2 dated June, 1991.
This program is distributed in the hope that it will be useful, but \s-1WITHOUT\s0 \s-1ANY\s0 \s-1WARRANTY\s0; without even the implied warranty of \s-1MERCHANTABILITY\s0 or \s-1FITNESS\s0 \s-1FOR\s0 A \s-1PARTICULAR\s0 \s-1PURPOSE\s0. See the \s-1GNU\s0 General Public License for more details.
You should have received a copy of the \s-1GNU\s0 General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, \s-1MA\s0 02110-1301, \s-1USA\s0.