]> git.proxmox.com Git - pve-manager.git/blame - PVE/CLI/vzdump.pm
doc: consistent vzdump --exclude-path documentation
[pve-manager.git] / PVE / CLI / vzdump.pm
CommitLineData
9a225ed5
DM
1package PVE::CLI::vzdump;
2
3use strict;
4use warnings;
5
6use PVE::CLIHandler;
7use PVE::API2::VZDump;
8
9use base qw(PVE::CLIHandler);
10
144a2199
DM
11# Note: use string 'vmid' as $arg_param option, to allow vmid lists
12our $cmddef = [ 'PVE::API2::VZDump', 'vzdump', 'vmid', undef,
9a225ed5
DM
13 sub {
14 my $upid = shift;
15 exit(0) if $upid eq 'OK';
16 my $status = PVE::Tools::upid_read_status($upid);
17 exit($status eq 'OK' ? 0 : -1);
18 }];
19
201;
21
22__END__
23
24=head1 NAME
25
26vzdump - backup utility for virtual machine
27
28=head1 SYNOPSIS
29
30=include synopsis
31
32=head1 DESCRIPTION
33
34vzdump is an utility to make consistent snapshots of running virtual
35machines (VMs). It basically creates an archive of the VM private area,
36which also includes the VM configuration files. vzdump currently
2b290f89 37supports LXC containers and QemuServer VMs.
9a225ed5
DM
38
39There are several ways to provide consistency (option C<mode>):
40
41=over 2
42
43=item C<stop> mode
44
45Stop the VM during backup. This results in a very long downtime.
46
47=item C<suspend> mode
48
2b290f89 49For containers, this mode uses rsync to copy the VM to a temporary
9a225ed5
DM
50location (see option --tmpdir). Then the VM is suspended and a second
51rsync copies changed files. After that, the VM is started (resume)
52again. This results in a minimal downtime, but needs additional space
53to hold the VM copy.
54
0125d38c
EK
55For QemuServer, this mode will suspend the VM, start
56a live backup, and resume the VM.
9a225ed5
DM
57
58=item C<snapshot> mode
59
0125d38c
EK
60For containers, this mode uses the snapshotting facilities of the underlying
61storage. A snapshot will be made of the container volume, and the snapshot content
62will be archived in a tar file.
63
64For QemuServer, this mode will do a live backup similar to the C<snaphost> mode, but without
65suspending/resuming the VM.
9a225ed5
DM
66
67=back
68
0125d38c
EK
69A technical overview of the Proxmox VE live backup for QemuServer can be found online at:
70https://git.proxmox.com/?p=pve-qemu-kvm.git;a=blob;f=backup.txt
71
9a225ed5
DM
72=head1 BACKUP FILE NAMES
73
74Newer version of vzdump encodes the virtual machine type and the
75backup time into the filename, for example
76
2b290f89 77 vzdump-lxc-105-2009_10_09-11_04_43.tar
9a225ed5
DM
78
79That way it is possible to store several backup into the same
80directory. The parameter C<maxfiles> can be used to specify the maximal
81number of backups to keep.
82
83=head1 RESTORE
84
85The resulting archive files can be restored with the following programs.
86
87=over 1
88
2b290f89 89=item pct restore: Containers restore utility
9a225ed5
DM
90
91=item qmrestore: QemuServer restore utility
92
93=back
94
95For details see the corresponding manual pages.
96
97=head1 CONFIGURATION
98
99Global configuration is stored in /etc/vzdump.conf.
100
101 tmpdir: DIR
102 dumpdir: DIR
103 storage: STORAGE_ID
104 mode: snapshot|suspend|stop
105 bwlimit: KBPS
106 ionize: PRI
107 lockwait: MINUTES
108 stopwait: MINUTES
109 size: MB
110 maxfiles: N
111 script: FILENAME
112 exclude-path: PATHLIST
113
114=head1 HOOK SCRIPT
115
116You can specify a hook script with option C<--script>. This script is called at various phases of the backup process, with parameters accordingly set. You can find an example in the documentation directory (C<vzdump-hook-script.pl>).
117
2b290f89 118=head1 EXCLUSIONS (Containers only)
9a225ed5
DM
119
120vzdump skips the following files wit option --stdexcludes
121
122 /var/log/.+
123 /tmp/.+
124 /var/tmp/.+
125 /var/run/.+pid
126
127You can manually specify exclude paths, for example:
128
d38e9382 129 # vzdump 777 --exclude-path /tmp/ --exclude-path /var/foo*
9a225ed5
DM
130
131(only excludes tmp directories)
132
133Configuration files are also stored inside the backup archive (/etc/vzdump), and will be correctly restored.
134
135=head1 LIMITATIONS
136
137VZDump does not save ACLs.
138
139=head1 EXAMPLES
140
141Simply dump VM 777 - no snapshot, just archive the VM private area and configuration files to the default dump directory (usually /vz/dump/).
142
143 # vzdump 777
144
145Use rsync and suspend/resume to create an snapshot (minimal downtime).
146
147 # vzdump 777 --mode suspend
148
149Backup all VMs and send notification mails to root and admin.
150
151 # vzdump --all --mode suspend --mailto root --mailto admin
152
153Use LVM2 to create snapshots (no downtime).
154
155 # vzdump 777 --dumpdir /mnt/backup --mode snapshot
156
157Backup more than one VM (selectively)
158
159 # vzdump 101 102 103 --mailto root
160
161Backup all VMs excluding VM 101 and 102
162
163 # vzdump --mode suspend --exclude 101,102
164
2b290f89 165Restore a container to a new VM 600
9a225ed5 166
2b290f89 167 # pct restore 600 /mnt/backup/vzdump-lxc-777.tar
9a225ed5 168
2b290f89 169Restore a Qemu/KVM machine to VM 601
9a225ed5
DM
170
171 # qmrestore /mnt/backup/vzdump-qemu-888.vma 601
172
2b290f89 173Clone an existing container 101 to a new container 300 with a 4GB root file system, using pipes
9a225ed5 174
2b290f89 175 # vzdump 101 --stdout | pct restore --rootfs 4 300 -
9a225ed5
DM
176
177=head1 SEE ALSO
178
2b290f89 179pct(1), qmrestore(1)
9a225ed5
DM
180
181=include pve_copyright