KVM Virtual Machine Backup

I’m using very simple way to back up my virtual machines:

1. I create a snapshot of my lvm volume where I keep images

2. Mount the snapshot

3. I tar all my images and copy them to other server

4. Umount and remove the snapshot

I have created a backup script that is run everyday by cron:


#!/bin/bash
DATE=`date +%Y%m%d%H`
#Create the snapshot
/usr/sbin/lvcreate --snapshot --name snap --size 30GB /dev/VolGroup00/LogVol02
#mount
/bin/mount /dev/VolGroup00/snap /snapshot
#archive machines
tar -zcf /backup_snap/VM1.${DATE}.tgz /snapshot/VM1.img
tar -zcf /backup_snap/VM2.${DATE}.tgz /snapshot/VM2.img
#umount
/bin/umount /snapshot
#remove snapshot
/usr/sbin/lvremove -f /dev/VolGroup00/snap


/backup_snap is mounted NFS share from my backup server where I keep my backups ( in other building of course :))

Here is fstab line for /backup_snap

10.1.1.100:/obraz_backup /backup_snap nfs defaults,soft 0 0

I use “soft” option in case if the share was unreachable so it wouldn’t block my server from booting up

Problem is that everyday I need to copy all images through network but i thing that only some bytes of information change in my image files. I’m looking for a solution that synchronizes files on byte level in linux, does anybody know something like that?

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s