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