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