forked from vazhnov/virt-backup.pl
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME
More file actions
87 lines (72 loc) · 3.75 KB
/
README
File metadata and controls
87 lines (72 loc) · 3.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
Copied from http://repo.firewall-services.com/misc/virt/virt-backup.pl
This version on https://github.com/vazhnov/virt-backup.pl
# AUTHOR
# Daniel Berteaud <daniel@firewall-services.com>
#
# COPYRIGHT
# Copyright (C) 2009 Daniel Berteaud
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# This script allows you to backup Virtual Machines managed by libvirt.
# It has only be tested with KVM based VM
# This script will dump:
# * each block devices
# * optionnally the memory (if --state flag is given)
# * the XML description of the VM
# These files are writen in a temporary backup dir. Everything is done
# in order to minimize donwtime of the guest. For example, it takes
# a snapshot of the block devices (if backed with LVM) so the guest is
# just paused for a couple of seconds. Once this is done, the guest is
# resumed, and the script starts to dump the snapshot.
# Once a backup is finished, you'll have several files in the backup
# directory. Let's take an example with a VM called my_vm which has
# two virtual disks: hda and hdb. You have passed the --state flag:
# * my_vm.lock: lock file to prevent another backup to run at the same time
# * my_vm.xml: this file is the XML description of the VM (for libvirt configuraiton)
# * my_vm_hda.img: this file is an image of the hda drive of the guest
# * my_vm_hdb.img: this file is an image of the hdb drive of the guest
# * my_vm.state: this is a dump of the memory (result of virsh save my_vm my_vm.state)
# This script was made to be ran with BackupPC pre/post commands.
# In the pre-backup phase, you dump everything then, backuppc backups,
# compress, pools etc... the dumped file. Eventually, when the backup is finished
# The script is called with the --cleanup flag, which cleanups everything.
# Some examples:
#
# Backup the VM named mail01 and devsrv. Also dump the memory.
# Exclude any virtual disk attached as vdb or hdb and on the fly
# compress the dumped disks (uses gzip by default)
# virt-backup.pl --dump --vm=mail01,devsrv --state --exclude=vdb,hdb --compress
# Remove all the files related to mail01 VM in the backup directory
# virt-backup.pl --cleanup --vm=mail01
# Backup devsrv, use 10G for LVM snapshots (if available), do not dump the memory
# (the guest will just be paused while we take a snapshot)
# Keep the lock file present after the dump
# virt-backup.pl --dump --vm=devsrv --snapsize=10G --keep-lock
# Backup devsrv, and disable LVM snapshots
# virt-backup.pl --dump --vm=devsrv --no-snapshot
# Backup mail01, and enable debug (verbose output)
# virt-backup.pl --dump --vm=mail01 --debug
### INSTALL:
# In Debian/Ubuntu, install dependencies:
# sudo apt-get install libxml-simple-perl libsys-virt-perl libfile-which-perl
### TODO:
# - Add snapshot (LVM) support for image based disk ? (should we detect the mount moint, and block device
# of the storage or let the user specify it with a --logical ?)
# - Additionnal check that the vm is available after a restore (via $dom->get_info->{status}, ping ?)
# - Check if compression utilies are available
# - Support per vm excludes in one run
### CHANGES
# * 26/03/2010
# - Initial packaged version