Giter Club home page Giter Club logo

virt-backup's Introduction

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

virt-backup's People

Contributors

syndicut avatar

Stargazers

Markus Heberling avatar

Watchers

Markus Heberling avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.