]> git.proxmox.com Git - pve-docs.git/blame - vzdump.adoc
sentence structure, wording
[pve-docs.git] / vzdump.adoc
CommitLineData
82b4917a
DM
1ifdef::manvolnum[]
2PVE({manvolnum})
3================
38fd0958 4include::attributes.txt[]
82b4917a
DM
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==================
38fd0958 25include::attributes.txt[]
82b4917a
DM
26endif::manvolnum[]
27
01d37422
DM
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.
82b4917a 33
01d37422
DM
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
fccf8df6 57https://git.proxmox.com/?p=pve-qemu-kvm.git;a=blob;f=backup.txt[here].
01d37422 58
d083d3d3
DM
59NOTE: Qemu backup provides snapshots on any storage type. It does
60not require that the underlying storage supports snapshots.
61
01d37422
DM
62
63.Backup `mode` for Containers:
82b4917a
DM
64
65`stop` mode::
66
8e4bb261
FG
67Stop the container for the duration of the backup. This potentially results in
68a very long downtime.
82b4917a
DM
69
70`suspend` mode::
71
01d37422 72This mode uses rsync to copy the container data to a temporary
6c60aebf
EK
73location (see option `--tmpdir`). Then the container is suspended and a second
74rsync copies changed files. After that, the container is started (resumed)
871e1fd6 75again. This results in minimal downtime, but needs additional space
6c60aebf 76to hold the container copy.
0006064d 77+
6c60aebf
EK
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.
8e4bb261
FG
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.
82b4917a
DM
83
84`snapshot` mode::
85
01d37422
DM
86This mode uses the snapshotting facilities of the underlying
87storage. A snapshot will be made of the container volume, and the
88snapshot content will be archived in a tar file.
82b4917a 89
82b4917a
DM
90
91Backup File Names
92-----------------
93
8e4bb261 94Newer versions of vzdump encode the guest type and the
82b4917a
DM
95backup time into the filename, for example
96
97 vzdump-lxc-105-2009_10_09-11_04_43.tar
98
871e1fd6 99That way it is possible to store several backup in the same
82b4917a 100directory. The parameter `maxfiles` can be used to specify the
871e1fd6 101maximum number of backups to keep.
82b4917a
DM
102
103Restore
104-------
105
106The resulting archive files can be restored with the following programs.
107
108
871e1fd6 109`pct restore`:: Container restore utility
82b4917a
DM
110
111`qmrestore`:: QemuServer restore utility
112
113For details see the corresponding manual pages.
114
115Configuration
116-------------
117
d083d3d3
DM
118Global configuration is stored in '/etc/vzdump.conf'. The file uses a
119simple colon separated key/value format. Each line has the following
120format:
121
122 OPTION: value
123
124Blank lines in the file are ignored, and lines starting with a '#'
956afd0a
DM
125character are treated as comments and are also ignored. Values from
126this file are used as default, and can be overwritten on the command
127line.
d083d3d3
DM
128
129We currently support the following options:
130
131include::vzdump.conf.5-opts.adoc[]
132
133
134.Example 'vzdump.conf' Configuration
135----
136tmpdir: /mnt/fast_local_disk
137storage: my_backup_storage
138mode: snapshot
139bwlimit: 10000
140----
82b4917a
DM
141
142Hook Scripts
143------------
144
145You can specify a hook script with option `--script`. This script is
146called at various phases of the backup process, with parameters
147accordingly set. You can find an example in the documentation
148directory ('vzdump-hook-script.pl').
149
150File Exclusions
151---------------
152
8e4bb261
FG
153NOTE: this option is only available for container backups.
154
155'vzdump' skips the following files by default (disable with the option
156`--stdexcludes 0`)
82b4917a 157
bf01f882
WB
158 /var/log/?*
159 /tmp/?*
160 /var/tmp/?*
161 /var/run/?*pid
82b4917a 162
8e4bb261 163You can also manually specify (additional) exclude paths, for example:
82b4917a 164
bf01f882 165 # vzdump 777 --exclude-path /tmp/ --exclude-path '/var/foo*'
82b4917a
DM
166
167(only excludes tmp directories)
168
169Configuration files are also stored inside the backup archive
65647b07 170(in `./etc/vzdump/`) and will be correctly restored.
82b4917a
DM
171
172Examples
173--------
174
c31f32a9 175Simply dump guest 777 - no snapshot, just archive the guest private area and
82b4917a 176configuration files to the default dump directory (usually
65647b07 177'/var/lib/vz/dump/').
82b4917a
DM
178
179 # vzdump 777
180
871e1fd6 181Use rsync and suspend/resume to create a snapshot (minimal downtime).
82b4917a
DM
182
183 # vzdump 777 --mode suspend
184
c31f32a9 185Backup all guest systems and send notification mails to root and admin.
82b4917a
DM
186
187 # vzdump --all --mode suspend --mailto root --mailto admin
188
189Use snapshot mode (no downtime).
190
191 # vzdump 777 --dumpdir /mnt/backup --mode snapshot
192
c31f32a9 193Backup more than one guest (selectively)
82b4917a
DM
194
195 # vzdump 101 102 103 --mailto root
196
c31f32a9 197Backup all guests excluding 101 and 102
82b4917a
DM
198
199 # vzdump --mode suspend --exclude 101,102
200
c31f32a9 201Restore a container to a new CT 600
82b4917a
DM
202
203 # pct restore 600 /mnt/backup/vzdump-lxc-777.tar
204
c31f32a9 205Restore a QemuServer VM to VM 601
82b4917a
DM
206
207 # qmrestore /mnt/backup/vzdump-qemu-888.vma 601
208
209Clone an existing container 101 to a new container 300 with a 4GB root
210file system, using pipes
211
212 # vzdump 101 --stdout | pct restore --rootfs 4 300 -
213
214
215ifdef::manvolnum[]
216include::pve-copyright.adoc[]
217endif::manvolnum[]
218