import vzdump docs
[pve-docs.git] / vzdump.adoc
CommitLineData
82b4917a
DM
1include::attributes.txt[]
2ifdef::manvolnum[]
3PVE({manvolnum})
4================
5
6NAME
7----
8
9vzdump - Backup Utility for VMs and Containers
10
11
12SYNOPSYS
13--------
14
15include::vzdump.1-synopsis.adoc[]
16
17
18DESCRIPTION
19-----------
20endif::manvolnum[]
21
22ifndef::manvolnum[]
23Backup and Restore
24==================
25endif::manvolnum[]
26
27'vzdump' is an utility to make consistent snapshots of running virtual
28machines (VMs). It basically creates an archive of the VM private
29area, which also includes the VM configuration files. 'vzdump'
30currently supports LXC containers and QemuServer VMs.
31
32There are several ways to provide consistency (option `mode`):
33
34`stop` mode::
35
36Stop the VM during backup. This results in a very long downtime.
37
38`suspend` mode::
39
40For containers, this mode uses rsync to copy the VM to a temporary
41location (see option `--tmpdir`). Then the VM is suspended and a second
42rsync copies changed files. After that, the VM is started (resume)
43again. This results in a minimal downtime, but needs additional space
44to hold the VM copy.
45
46For QemuServer, this mode will suspend the VM, start
47a live backup, and resume the VM.
48
49`snapshot` mode::
50
51For containers, this mode uses the snapshotting facilities of the
52underlying storage. A snapshot will be made of the container volume,
53and the snapshot content will be archived in a tar file.
54
55For QemuServer, this mode will do a live backup similar to the
56`snaphost` mode, but without suspending/resuming the VM.
57
58A technical overview of the Proxmox VE live backup for QemuServer can
59be found online
60https://git.proxmox.com/?p=pve-qemu-kvm.git;a=blob;f=backup.txt[here],
61
62Backup File Names
63-----------------
64
65Newer version of vzdump encodes the virtual machine type and the
66backup time into the filename, for example
67
68 vzdump-lxc-105-2009_10_09-11_04_43.tar
69
70That way it is possible to store several backup into the same
71directory. The parameter `maxfiles` can be used to specify the
72maximal number of backups to keep.
73
74Restore
75-------
76
77The resulting archive files can be restored with the following programs.
78
79
80`pct restore`:: Containers restore utility
81
82`qmrestore`:: QemuServer restore utility
83
84For details see the corresponding manual pages.
85
86Configuration
87-------------
88
89Global configuration is stored in '/etc/vzdump.conf'.
90
91 tmpdir: DIR
92 dumpdir: DIR
93 storage: STORAGE_ID
94 mode: snapshot|suspend|stop
95 bwlimit: KBPS
96 ionize: PRI
97 lockwait: MINUTES
98 stopwait: MINUTES
99 size: MB
100 maxfiles: N
101 script: FILENAME
102 exclude-path: PATHLIST
103
104Hook Scripts
105------------
106
107You can specify a hook script with option `--script`. This script is
108called at various phases of the backup process, with parameters
109accordingly set. You can find an example in the documentation
110directory ('vzdump-hook-script.pl').
111
112File Exclusions
113---------------
114
115First, this option is only available for container backups. 'vzdump'
116skips the following files with option `--stdexcludes`
117
118 /var/log/.+
119 /tmp/.+
120 /var/tmp/.+
121 /var/run/.+pid
122
123Or you can manually specify exclude paths, for example:
124
125 # vzdump 777 --exclude-path '/tmp/.+' --exclude-path '/var/tmp/.+'
126
127(only excludes tmp directories)
128
129Configuration files are also stored inside the backup archive
130(`/etc/vzdump/`), and will be correctly restored.
131
132Examples
133--------
134
135Simply dump VM 777 - no snapshot, just archive the VM private area and
136configuration files to the default dump directory (usually
137'/var/liv//vz/dump/').
138
139 # vzdump 777
140
141Use rsync and suspend/resume to create an snapshot (minimal downtime).
142
143 # vzdump 777 --mode suspend
144
145Backup all VMs and send notification mails to root and admin.
146
147 # vzdump --all --mode suspend --mailto root --mailto admin
148
149Use snapshot mode (no downtime).
150
151 # vzdump 777 --dumpdir /mnt/backup --mode snapshot
152
153Backup more than one VM (selectively)
154
155 # vzdump 101 102 103 --mailto root
156
157Backup all VMs excluding VM 101 and 102
158
159 # vzdump --mode suspend --exclude 101,102
160
161Restore a container to a new VM 600
162
163 # pct restore 600 /mnt/backup/vzdump-lxc-777.tar
164
165Restore a Qemu/KVM machine to VM 601
166
167 # qmrestore /mnt/backup/vzdump-qemu-888.vma 601
168
169Clone an existing container 101 to a new container 300 with a 4GB root
170file system, using pipes
171
172 # vzdump 101 --stdout | pct restore --rootfs 4 300 -
173
174
175ifdef::manvolnum[]
176include::pve-copyright.adoc[]
177endif::manvolnum[]
178