]> git.proxmox.com Git - pve-docs.git/blame_incremental - vzdump.adoc
add general introduction and chapters matching the qm creation wizard in the GUI
[pve-docs.git] / vzdump.adoc
... / ...
CommitLineData
1ifdef::manvolnum[]
2PVE({manvolnum})
3================
4include::attributes.txt[]
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==================
25include::attributes.txt[]
26endif::manvolnum[]
27
28'vzdump' is a utility to make consistent backups of running guest
29systems. It basically creates an archive of the guest private area,
30which also includes the guest configuration files. 'vzdump' currently
31supports LXC containers and QemuServer VMs. There are several ways to
32provide consistency (option `mode`), depending on the guest type.
33
34.Backup `mode` for VMs:
35
36`stop` mode::
37
38This first performns a clean shutdown of the VM to make sure it is
39stopped. It then starts the VM in suspended mode and uses the qemu
40backup feature to dump all data. If the VM was running, we start
41(resume) it immediately after starting the qemu backup task. This
42keeps the downtime as low as possible.
43
44`suspend` mode::
45
46This mode does not really make sense for qemu. Please use snapshot
47mode instead.
48
49`snapshot` mode::
50
51This mode simply starts a qemu live backup task. If the guest agent
52is enabled (`agent: 1`) and running, it calls 'guest-fsfreeze-freeze'
53and 'guest-fsfreeze-thaw' to improve consistency.
54
55A technical overview of the Proxmox VE live backup for QemuServer can
56be found online
57https://git.proxmox.com/?p=pve-qemu-kvm.git;a=blob;f=backup.txt[here].
58
59NOTE: Qemu backup provides snapshots on any storage type. It does
60not require that the underlying storage supports snapshots.
61
62
63.Backup `mode` for Containers:
64
65`stop` mode::
66
67Stop the container for the duration of the backup. This potentially results in
68a very long downtime.
69
70`suspend` mode::
71
72This mode uses rsync to copy the container data to a temporary
73location (see option `--tmpdir`). Then the container is suspended and a second
74rsync copies changed files. After that, the container is started (resumed)
75again. This results in minimal downtime, but needs additional space
76to hold the container copy.
77+
78When the container is on a local filesystem and the target storage of the backup
79is an NFS server, you should set `--tmpdir` to reside on a local filesystem too,
80as this will result in a many fold performance improvement.
81Use of a local `tmpdir` is also required if you want to backup a local container
82using ACLs in suspend mode if the backup storage is an NFS server.
83
84`snapshot` mode::
85
86This mode uses the snapshotting facilities of the underlying
87storage. First, the container will be suspended to ensure data consistency.
88A temporary snapshot of the container's volumes will be made and the
89snapshot content will be archived in a tar file. Finally, the temporary
90snapshot is deleted again.
91
92NOTE: `snapshot` mode requires that all backed up volumes are on a storage that
93supports snapshots. Using the `backup=no` mountpoint option individual volumes
94can be excluded from the backup (and thus this requirement).
95
96
97Backup File Names
98-----------------
99
100Newer versions of vzdump encode the guest type and the
101backup time into the filename, for example
102
103 vzdump-lxc-105-2009_10_09-11_04_43.tar
104
105That way it is possible to store several backup in the same
106directory. The parameter `maxfiles` can be used to specify the
107maximum number of backups to keep.
108
109Restore
110-------
111
112The resulting archive files can be restored with the following programs.
113
114
115`pct restore`:: Container restore utility
116
117`qmrestore`:: QemuServer restore utility
118
119For details see the corresponding manual pages.
120
121Configuration
122-------------
123
124Global configuration is stored in '/etc/vzdump.conf'. The file uses a
125simple colon separated key/value format. Each line has the following
126format:
127
128 OPTION: value
129
130Blank lines in the file are ignored, and lines starting with a '#'
131character are treated as comments and are also ignored. Values from
132this file are used as default, and can be overwritten on the command
133line.
134
135We currently support the following options:
136
137include::vzdump.conf.5-opts.adoc[]
138
139
140.Example 'vzdump.conf' Configuration
141----
142tmpdir: /mnt/fast_local_disk
143storage: my_backup_storage
144mode: snapshot
145bwlimit: 10000
146----
147
148Hook Scripts
149------------
150
151You can specify a hook script with option `--script`. This script is
152called at various phases of the backup process, with parameters
153accordingly set. You can find an example in the documentation
154directory ('vzdump-hook-script.pl').
155
156File Exclusions
157---------------
158
159NOTE: this option is only available for container backups.
160
161'vzdump' skips the following files by default (disable with the option
162`--stdexcludes 0`)
163
164 /var/log/?*
165 /tmp/?*
166 /var/tmp/?*
167 /var/run/?*pid
168
169You can also manually specify (additional) exclude paths, for example:
170
171 # vzdump 777 --exclude-path /tmp/ --exclude-path '/var/foo*'
172
173(only excludes tmp directories)
174
175Configuration files are also stored inside the backup archive
176(in `./etc/vzdump/`) and will be correctly restored.
177
178Examples
179--------
180
181Simply dump guest 777 - no snapshot, just archive the guest private area and
182configuration files to the default dump directory (usually
183'/var/lib/vz/dump/').
184
185 # vzdump 777
186
187Use rsync and suspend/resume to create a snapshot (minimal downtime).
188
189 # vzdump 777 --mode suspend
190
191Backup all guest systems and send notification mails to root and admin.
192
193 # vzdump --all --mode suspend --mailto root --mailto admin
194
195Use snapshot mode (no downtime) and non-default dump directory.
196
197 # vzdump 777 --dumpdir /mnt/backup --mode snapshot
198
199Backup more than one guest (selectively)
200
201 # vzdump 101 102 103 --mailto root
202
203Backup all guests excluding 101 and 102
204
205 # vzdump --mode suspend --exclude 101,102
206
207Restore a container to a new CT 600
208
209 # pct restore 600 /mnt/backup/vzdump-lxc-777.tar
210
211Restore a QemuServer VM to VM 601
212
213 # qmrestore /mnt/backup/vzdump-qemu-888.vma 601
214
215Clone an existing container 101 to a new container 300 with a 4GB root
216file system, using pipes
217
218 # vzdump 101 --stdout | pct restore --rootfs 4 300 -
219
220
221ifdef::manvolnum[]
222include::pve-copyright.adoc[]
223endif::manvolnum[]
224