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