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