mercredi 22 février 2012
fsarchiver: Backuping (PV)HVM domU Linux (LVM)
Par david techer, mercredi 22 février 2012 à 01:40 :: Xen

dd
and pbzip2
. The main command was something like - from dom0 -
# 1. Create a LVM snapshot lvcreate -s -n <name_of_the_snapshot> -L<size>G /dev/xenvg/<name_of_LVM> # 2. Backuping VM dd if=/dev/xenvg/<name_of_the_snapshot> | pbzip2 -c -z -m1024 -v -p3 > /path/to/<name_of_backup_VM>.img.bz2Today for personal reason, I will like to test a new tool:
fsarchiver
1. fsarchiver - informations
For more details, have a look on the main Web site : http://www.fsarchiver.org/Main_Page2. fsarchiver - installation
- Prerequisites for Debian Squeeze
apt-get update apt-get install zlib1g-dev libssl-dev libbz2-dev liblzo2-dev e2fslibs-dev attr-dev libssl-dev libblkid-dev uuid-dev libgcrypt11-dev
- lzma depends on xz
wget http://tukaani.org/xz/xz-5.0.3.tar.bz2 tar xjf xz-5.0.3.tar.bz2 cd xz-5.0.3/ ./configure make -j4 make check make install && ldconfig
- farchiver
Download the last sources from http://sourceforge.net/projects/fsarchiver/files/fsarchiver-src/ then
tar xvf fsarchiver-0.6.12.tar.gz cd fsarchiver-0.6.12/ ./configure make -j4 make install && ldconfig
3. Test for backups
I've got a domU mercury-xen01. This is a Linux PVHVM - I used it for my tests for VGA PassThrough -. This domU relies on LVM:/dev/xenvg/mercury-xen01-disk-1
3.1 Make a snapshot before testing
lvcreate -s -n mercury-xen01-disk-1.snapshot -L30G /dev/xenvg/mercury-xen01-disk-1
- Now we can use
kpart
root@mercury:~# kpartx -va /dev/xenvg/mercury-xen01-disk-1 add map xenvg-mercury--xen01--disk--1p1 (253:14): 0 402339840 linear /dev/xenvg/mercury-xen01-disk-1 2048 add map xenvg-mercury--xen01--disk--1p2 (253:15): 0 17084418 linear /dev/xenvg/mercury-xen01-disk-1 402343934 add map xenvg-mercury--xen01--disk--1p5 : 0 17084416 linear 253:15 2
3.2 Backup with default compression level (-z3 / gzip)
This is the default compression level (equivalent to gzip -6 ) First have a look http://www.fsarchiver.org/Compressionfsarchiver savefs -j4 -v -o /opt/montage/mercury-xen01-disk-1_backup_2012-02-21.fsa /dev/mapper/xenvg-mercury--xen01--disk--1p1For information about archive
root@mercury:~# fsarchiver archinfo /opt/montage/mercury-xen01-disk-1_backup_2012-02-21.fsa ====================== archive information ====================== Archive type: filesystems Filesystems count: 1 Archive id: 4f4c603b Archive file format: FsArCh_002 Archive created with: 0.6.12 Archive creation date: 2012-02-22_01-59-35 Archive label:Archive sizeMinimum fsarchiver version: 0.6.4.0 Compression level: 3 (gzip level 6) Encryption algorithm: none ===================== filesystem information ==================== Filesystem id in archive: 0 Filesystem format: ext4 Filesystem label: Filesystem uuid: be744358-3672-4a94-818d-c09c178b01d2 Original device: /dev/mapper/xenvg-mercury--xen01--disk--1p1 Original filesystem size: 188.84 GB (202765496320 bytes) Space used in filesystem: 10.05 GB (10787442688 bytes)
root@mercury:~# du -hs /opt/montage/mercury-xen01-disk-1_backup_2012-02-21.fsa 4,1G /opt/montage/mercury-xen01-disk-1_backup_2012-02-21.fsa