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