backup xen images with dar

I’ve modified a script to backup live xen images with dar. This script uses lvm to snapshot a running VM disk, then mount it read only and uses dar to create an incremental backup. The script is a derivative of a script I’ve found on the net [1]. There is still a small problem with journaled file system that even if the fs is frozen before taking the snapshot, for some reason, even if I mount it read only, the kernel module tries to go through the journal to recover the fs. I’m worried that this might lead to data corruptions… There is this old thread [2] shading a bit of light on the problem.

The script is pretty simple. To create a full backup of a xen domain the command line is:

./xenBackup.sh -d domainname

to create an incremental backup :

./xenBackup.sh -d domainname -i 1

where -i is the sequence number of the incremental backup. Of course you need the previous incremental backup for the operation to be successful (if i = 1, you need a full backup) . You can use this script from cron, running a full backup on sunday and an incremental backup every day of the week.

Script attached.

[1] http://www.johnandcailin.com/blog/john/backing-your-xen-domains [2] http://www.nabble.com/Xen-backups-using-LVM-Snapshots-td19988096.html


lvm and friends

Date Tags lvm / xfs

Not a tutorial, just few lines to write down what I’ve done.

This command gives you information about all virtual groups

vgdisplay -v

Then, to create a logical group :

lvcreate -l 59581 -n data vg1

the -l option specifies the number of extent to allocate for this lv . You can see the number of available extents for a vg with the command above. This is useful to know when you want to create a lv using all the available space.

Then let’s create an xfs fs on this lv :

mkfs.xfs -l logdev=/dev/vg1/log1,size=128m -f /dev/vg1/data

I’m not going to specify any other esoteric settings to build the fs. The only important option here is to specify external log partition.

To mount the partition we need to give a log list of parameters.

mount -t xfs /dev/vg1/data ex -o noatime,nodiratime,nobarrier,logbufs=8,logdev=/dev/vg1/log1

There are a lot of threads around. This is a good pointer.

http://thias.marmotte.net/archives/2008/01/05/Dell-PERC5E-and-MD1000-performance-tweaks.html

Next jumbo frames !