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 | ||
871e1fd6 | 28 | 'vzdump' is a utility to make consistent snapshots of running virtual |
82b4917a DM |
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 | ||
6c60aebf EK |
41 | For containers, this mode uses rsync to copy the container data to a temporary |
42 | location (see option `--tmpdir`). Then the container is suspended and a second | |
43 | rsync copies changed files. After that, the container is started (resumed) | |
871e1fd6 | 44 | again. This results in minimal downtime, but needs additional space |
6c60aebf | 45 | to hold the container copy. |
0006064d | 46 | + |
6c60aebf EK |
47 | When the container is on a local filesystem and the target storage of the backup |
48 | is an NFS server, you should set `--tmpdir` to reside on a local filesystem too, | |
49 | as this will result in a many fold performance improvement. | |
50 | Use of a local `tmpdir` is also required if you want to backup in `suspend` | |
51 | mode a local container using ACLs to an NFS server. | |
0006064d | 52 | + |
82b4917a | 53 | For QemuServer, this mode will suspend the VM, start |
0006064d DM |
54 | a live backup, and resume the VM. This does not require a temporary |
55 | storage. | |
82b4917a DM |
56 | |
57 | `snapshot` mode:: | |
58 | ||
59 | For containers, this mode uses the snapshotting facilities of the | |
60 | underlying storage. A snapshot will be made of the container volume, | |
61 | and the snapshot content will be archived in a tar file. | |
0006064d | 62 | + |
82b4917a | 63 | For QemuServer, this mode will do a live backup similar to the |
871e1fd6 | 64 | `suspend` mode, but without suspending/resuming the VM. |
82b4917a DM |
65 | |
66 | A technical overview of the Proxmox VE live backup for QemuServer can | |
67 | be found online | |
68 | https://git.proxmox.com/?p=pve-qemu-kvm.git;a=blob;f=backup.txt[here], | |
69 | ||
70 | Backup File Names | |
71 | ----------------- | |
72 | ||
871e1fd6 | 73 | Newer versions of vzdump encode the virtual machine type and the |
82b4917a DM |
74 | backup time into the filename, for example |
75 | ||
76 | vzdump-lxc-105-2009_10_09-11_04_43.tar | |
77 | ||
871e1fd6 | 78 | That way it is possible to store several backup in the same |
82b4917a | 79 | directory. The parameter `maxfiles` can be used to specify the |
871e1fd6 | 80 | maximum number of backups to keep. |
82b4917a DM |
81 | |
82 | Restore | |
83 | ------- | |
84 | ||
85 | The resulting archive files can be restored with the following programs. | |
86 | ||
87 | ||
871e1fd6 | 88 | `pct restore`:: Container restore utility |
82b4917a DM |
89 | |
90 | `qmrestore`:: QemuServer restore utility | |
91 | ||
92 | For details see the corresponding manual pages. | |
93 | ||
94 | Configuration | |
95 | ------------- | |
96 | ||
97 | Global configuration is stored in '/etc/vzdump.conf'. | |
98 | ||
99 | tmpdir: DIR | |
100 | dumpdir: DIR | |
101 | storage: STORAGE_ID | |
102 | mode: snapshot|suspend|stop | |
103 | bwlimit: KBPS | |
104 | ionize: PRI | |
105 | lockwait: MINUTES | |
106 | stopwait: MINUTES | |
107 | size: MB | |
108 | maxfiles: N | |
109 | script: FILENAME | |
110 | exclude-path: PATHLIST | |
111 | ||
112 | Hook Scripts | |
113 | ------------ | |
114 | ||
115 | You can specify a hook script with option `--script`. This script is | |
116 | called at various phases of the backup process, with parameters | |
117 | accordingly set. You can find an example in the documentation | |
118 | directory ('vzdump-hook-script.pl'). | |
119 | ||
120 | File Exclusions | |
121 | --------------- | |
122 | ||
123 | First, this option is only available for container backups. 'vzdump' | |
124 | skips the following files with option `--stdexcludes` | |
125 | ||
bf01f882 WB |
126 | /var/log/?* |
127 | /tmp/?* | |
128 | /var/tmp/?* | |
129 | /var/run/?*pid | |
82b4917a DM |
130 | |
131 | Or you can manually specify exclude paths, for example: | |
132 | ||
bf01f882 | 133 | # vzdump 777 --exclude-path /tmp/ --exclude-path '/var/foo*' |
82b4917a DM |
134 | |
135 | (only excludes tmp directories) | |
136 | ||
137 | Configuration files are also stored inside the backup archive | |
138 | (`/etc/vzdump/`), and will be correctly restored. | |
139 | ||
140 | Examples | |
141 | -------- | |
142 | ||
143 | Simply dump VM 777 - no snapshot, just archive the VM private area and | |
144 | configuration files to the default dump directory (usually | |
145 | '/var/liv//vz/dump/'). | |
146 | ||
147 | # vzdump 777 | |
148 | ||
871e1fd6 | 149 | Use rsync and suspend/resume to create a snapshot (minimal downtime). |
82b4917a DM |
150 | |
151 | # vzdump 777 --mode suspend | |
152 | ||
153 | Backup all VMs and send notification mails to root and admin. | |
154 | ||
155 | # vzdump --all --mode suspend --mailto root --mailto admin | |
156 | ||
157 | Use snapshot mode (no downtime). | |
158 | ||
159 | # vzdump 777 --dumpdir /mnt/backup --mode snapshot | |
160 | ||
161 | Backup more than one VM (selectively) | |
162 | ||
163 | # vzdump 101 102 103 --mailto root | |
164 | ||
165 | Backup all VMs excluding VM 101 and 102 | |
166 | ||
167 | # vzdump --mode suspend --exclude 101,102 | |
168 | ||
169 | Restore a container to a new VM 600 | |
170 | ||
171 | # pct restore 600 /mnt/backup/vzdump-lxc-777.tar | |
172 | ||
173 | Restore a Qemu/KVM machine to VM 601 | |
174 | ||
175 | # qmrestore /mnt/backup/vzdump-qemu-888.vma 601 | |
176 | ||
177 | Clone an existing container 101 to a new container 300 with a 4GB root | |
178 | file system, using pipes | |
179 | ||
180 | # vzdump 101 --stdout | pct restore --rootfs 4 300 - | |
181 | ||
182 | ||
183 | ifdef::manvolnum[] | |
184 | include::pve-copyright.adoc[] | |
185 | endif::manvolnum[] | |
186 |