On Thu, Nov 12, 2009 at 6:37 PM, Fajar A. Nugraha fajar@fajar.net wrote:
On Thu, Nov 12, 2009 at 5:10 PM, Mr. Teo En Ming (Zhang Enming) space.time.universe@gmail.com wrote:
Hi,
I don't think I will be using the LVM snapshot method. I will simply
ensure
that my domU is not running,
Ah, so you can live with the down time. It makes things a lot simpler then.
then I proceed to do the losetup and kpartx procedure.
Like others mentioned, you don't need losetup for LVs. It will only make things slower.
Subsequently I will backup the MBR of my domU by dd-ing /dev/loopX and clone all the filesystems of the domU using fsarchiver.
I would like to use fsarchiver because it can support LZMA compression.
LZMA
can compress better than bzip2 and decompress 3x faster than bzip2. partimage only supports gzip and bzip2.
If your concern is the size and speed of backup, here's one final note from me: you might want to look at zfs. Possible use scenarios :
- use opensolaris as dom0. Probably the most supported option when it
comes to xen + zfs, but you need to be familiar with how opensolaris works.
- use external storage server running solaris/opensolaris as iscsi
SAN. Think of it as poor-man's Netapp.
- use zfs-fuse inside Linux dom0, and store domU storage as files
- use zfs-fuse on domU, and do backup from domU instead of dom0.
With zfs, you'd get zfs snapshot (which is like instaneous in-place backup), incremental block-level send (can greatly reduce backup storage size if your data doesn't change often), optional transparent compression for live data (like what ntfs has).
-- Fajar
I am not familiar with OpenSolaris but that may change with time.
On Thu, Nov 12, 2009 at 8:53 PM, Mr. Teo En Ming (Zhang Enming) < space.time.universe@gmail.com> wrote:
On Thu, Nov 12, 2009 at 6:37 PM, Fajar A. Nugraha fajar@fajar.net wrote:
On Thu, Nov 12, 2009 at 5:10 PM, Mr. Teo En Ming (Zhang Enming) space.time.universe@gmail.com wrote:
Hi,
I don't think I will be using the LVM snapshot method. I will simply
ensure
that my domU is not running,
Ah, so you can live with the down time. It makes things a lot simpler then.
then I proceed to do the losetup and kpartx procedure.
Like others mentioned, you don't need losetup for LVs. It will only make things slower.
Subsequently I will backup the MBR of my domU by dd-ing /dev/loopX and clone all the filesystems of the domU using fsarchiver.
I would like to use fsarchiver because it can support LZMA compression.
LZMA
can compress better than bzip2 and decompress 3x faster than bzip2. partimage only supports gzip and bzip2.
If your concern is the size and speed of backup, here's one final note from me: you might want to look at zfs. Possible use scenarios :
- use opensolaris as dom0. Probably the most supported option when it
comes to xen + zfs, but you need to be familiar with how opensolaris works.
- use external storage server running solaris/opensolaris as iscsi
SAN. Think of it as poor-man's Netapp.
- use zfs-fuse inside Linux dom0, and store domU storage as files
- use zfs-fuse on domU, and do backup from domU instead of dom0.
With zfs, you'd get zfs snapshot (which is like instaneous in-place backup), incremental block-level send (can greatly reduce backup storage size if your data doesn't change often), optional transparent compression for live data (like what ntfs has).
-- Fajar
I am not familiar with OpenSolaris but that may change with time.
-- Mr. Teo En Ming (Zhang Enming) Dip(Mechatronics) BEng(Hons)(Mechanical Engineering) Alma Maters: (1) Singapore Polytechnic (2) National University of Singapore My Primary Blog: http://teo-en-ming-aka-zhang-enming.blogspot.com My Secondary Blog: http://enmingteo.wordpress.com My Youtube videos: http://www.youtube.com/user/enmingteo Email: space.time.universe@gmail.com Mobile Phone (Starhub Prepaid): +65-8369-2618 Street: Bedok Reservoir Road Country: Singapore
Hi,
I have just finished writing my backup/cloning script. Could anyone help me verify whether my backup script will work?
<SCRIPT>
#!/bin/sh
# Script to Backup/Clone Xen Host/Dom0 and all DomUs which are using Logical Volumes as Virtual Hard Disks
# Written by:
# Mr. Teo En Ming (Zhang Enming) Dip(Mechatronics) BEng(Hons)(Mechanical Engineering) # Alma Maters: # (1) Singapore Polytechnic # (2) National University of Singapore # Primary Blog: http://teo-en-ming-aka-zhang-enming.blogspot.com # Secondary Blog: http://enmingteo.wordpress.com # Youtube Videos: http://www.youtube.com/user/enmingteo # Email: space.time.universe@gmail.com # MSN: teoenming@hotmail.com # Mobile Phone (Starhub Prepaid): +65-8369-2618 # Street: Bedok Reservoir Road # Country: Singapore
# First written: 13 November 2009 Friday 12:38 A.M. Singapore time # Last updated: 13 November 2009 Friday 12:38 A.M. Singapore time
# REFERNCE: "Geek Sheet: Bare-metal backup and recovery", May 7th, 2008, Jason Perlow # URL: http://blogs.zdnet.com/BTL/?p=8759
# Usage Instructions:
# Boot up your computer/server with System Rescue CD version 1.3.2 for i386/amd64. # Then execute this backup script. You need to adapt this script to work for your environment. # Download System Rescue CD from http://www.sysresccd.org/Main_Page
############################################################################################################### # Declare Variables ###############################################################################################################
HARDDISK=/dev/sda DEST=/media/hitachi/test
############################################################################################################### # Cloning Xen Host/Dom0 ###############################################################################################################
# Backup MBR
dd if=$HARDDISK of=$DEST/f11-xen-dom0-sda.mbr bs=512 count=1
# Activate all logical volumes in all volume groups
vgchange -ay
# Backup UUIDs of PVs
pvdisplay > $DEST/f11-xen-dom0-pvdisplay.txt
# Backup LVM Metadata
# Backup the configuration of dedicated volume group for dom0
vgcfgbackup -d -v vg_fedora11_host -f $DEST/vg_fedora11_host.vgcfg.backup
# Backup the configuration of dedicated volume group for domUs
vgcfgbackup -d -v virtualmachines -f $DEST/virtualmachines.vgcfg.backup
# Backup /boot partition and all logical volumes of dedicated volume group for host/dom0
fsarchiver savefs -v -z 9 -j 2 $DEST/f11-xen-dom0-filesystems.fsa /dev/sda1 /dev/vg_fedora11_host/lv_home \ /dev/vg_fedora11_host/lv_root /dev/vg_fedora11_host/lv_var
############################################################################################################### # Cloning Xen-based Virtual Machines/DomUs/Guest Operating Systems/VMs ###############################################################################################################
# The following 8 virtual machines have physical volumes, so it is not possible to image using partimage or # fsarchiver directly. The only convenient way is to dd the logical volume for the VM, ie. sector by sector # copy. Other methods would be very tedious.
# VM 1: Fedora 11 x86_64 PV domU
dd if=/dev/virtualmachines/f11-pv-hpc-node0001 | gzip --fast > $DEST/f11-pv-hpc-node0001.img
# VM 2: Fedora 11 x86_64 PV domU
dd if=/dev/virtualmachines/f11-pv-hpc-node0002 | gzip --fast > $DEST/f11-pv-hpc-node0002.img
# VM 3: Fedora 11 x86_64 PV domU
dd if=/dev/virtualmachines/f11-pv-hpc-node0003 | gzip --fast > $DEST/f11-pv-hpc-node0003.img
# VM 4: Fedora 11 x86_64 PV domU
dd if=/dev/virtualmachines/f11-pv-hpc-node0004 | gzip --fast > $DEST/f11-pv-hpc-node0004.img
# VM 5: Fedora 11 x86_64 PV domU
dd if=/dev/virtualmachines/f11-pv-hpc-node0005 | gzip --fast > $DEST/f11-pv-hpc-node0005.img
# VM 6: Fedora 11 x86_64 PV domU
dd if=/dev/virtualmachines/f11-pv-hpc-node0006 | gzip --fast > $DEST/f11-pv-hpc-node0006.img
# VM 7: Fedora 11 x86_64 PV domU
dd if=/dev/virtualmachines/f11-pv-hpc-node0007 | gzip --fast > $DEST/f11-pv-hpc-node0007.img
# VM 8: Fedora 11 x86_64 PV domU
dd if=/dev/virtualmachines/f11-pv-hpc-node0008 | gzip --fast > $DEST/f11-pv-hpc-node0008.img
# VM 9: FreeBSD 8.0 RC2 UNIX amd64 HVM domU
dd if=/dev/virtualmachines/freebsd | gzip --fast > $DEST/freebsd.img
# VM 10: OpenSolaris 2009.06 UNIX amd64 PV domU
dd if=/dev/virtualmachines/opensolaris | gzip --fast > $DEST/opensolaris.img
# VM 11: Rocks 5.1 x86_64 HPC Compute Cluster HVM domU
kpartx -av /dev/virtualmachines/rocks0001
dd if=/dev/virtualmachines/rocks0001 of=$DEST/rocks0001.mbr bs=512 count=1
partimage -d -M -b -z1 save /dev/mapper/virtualmachines-rocks0001p1 $DEST/virtualmachines-rocks0001p1.img
partimage -d -M -b -z1 save /dev/mapper/virtualmachines-rocks0001p2 $DEST/virtualmachines-rocks0001p2.img
partimage -d -M -b -z1 save /dev/mapper/virtualmachines-rocks0001p5 $DEST/virtualmachines-rocks0001p5.img
kpartx -dv /dev/virtualmachines/rocks0001
# VM 12: Rocks 5.1 x86_64 HPC Compute Cluster HVM domU
kpartx -av /dev/virtualmachines/rocks0002
dd if=/dev/virtualmachines/rocks0002 of=$DEST/rocks0002.mbr bs=512 count=1
partimage -d -M -b -z1 save /dev/mapper/virtualmachines-rocks0002p1 $DEST/virtualmachines-rocks0002p1.img
partimage -d -M -b -z1 save /dev/mapper/virtualmachines-rocks0002p2 $DEST/virtualmachines-rocks0002p2.img
partimage -d -M -b -z1 save /dev/mapper/virtualmachines-rocks0002p5 $DEST/virtualmachines-rocks0002p5.img
kpartx -dv /dev/virtualmachines/rocks0002
# VM 13: Rocks 5.1 x86_64 HPC Compute Cluster HVM domU
kpartx -av /dev/virtualmachines/rocks0003
dd if=/dev/virtualmachines/rocks0003 of=$DEST/rocks0003.mbr bs=512 count=1
partimage -d -M -b -z1 save /dev/mapper/virtualmachines-rocks0003p1 $DEST/virtualmachines-rocks0003p1.img
partimage -d -M -b -z1 save /dev/mapper/virtualmachines-rocks0003p2 $DEST/virtualmachines-rocks0003p2.img
partimage -d -M -b -z1 save /dev/mapper/virtualmachines-rocks0003p5 $DEST/virtualmachines-rocks0003p5.img
kpartx -dv /dev/virtualmachines/rocks0003
# VM 14: Rocks 5.1 x86_64 HPC Compute Cluster HVM domU
kpartx -av /dev/virtualmachines/rocks0004
dd if=/dev/virtualmachines/rocks0004 of=$DEST/rocks0004.mbr bs=512 count=1
partimage -d -M -b -z1 save /dev/mapper/virtualmachines-rocks0004p1 $DEST/virtualmachines-rocks0004p1.img
partimage -d -M -b -z1 save /dev/mapper/virtualmachines-rocks0004p2 $DEST/virtualmachines-rocks0004p2.img
partimage -d -M -b -z1 save /dev/mapper/virtualmachines-rocks0004p5 $DEST/virtualmachines-rocks0004p5.img
kpartx -dv /dev/virtualmachines/rocks0004
# VM 15: Rocks 5.1 x86_64 HPC Compute Cluster HVM domU
kpartx -av /dev/virtualmachines/rocks0005
dd if=/dev/virtualmachines/rocks0005 of=$DEST/rocks0005.mbr bs=512 count=1
partimage -d -M -b -z1 save /dev/mapper/virtualmachines-rocks0005p1 $DEST/virtualmachines-rocks0005p1.img
partimage -d -M -b -z1 save /dev/mapper/virtualmachines-rocks0005p2 $DEST/virtualmachines-rocks0005p2.img
partimage -d -M -b -z1 save /dev/mapper/virtualmachines-rocks0005p5 $DEST/virtualmachines-rocks0005p5.img
kpartx -dv /dev/virtualmachines/rocks0005
# VM 16: Slackware64 13.0 amd64 HVM domU
kpartx -av /dev/virtualmachines/slackware64
dd if=/dev/virtualmachines/slackware64 of=$DEST/slackware64.mbr bs=512 count=1
partimage -d -M -b -z1 save /dev/mapper/virtualmachines-slackware64p1 $DEST/virtualmachines-slackware64p1.img
partimage -d -M -b -z1 save /dev/mapper/virtualmachines-slackware64p2 $DEST/virtualmachines-slackware64p2.img
kpartx -dv /dev/virtualmachines/slackware64
# VM 17: Ubuntu 9.10 Karmic Koala Linux HVM domU
kpartx -av /dev/virtualmachines/ubuntu910
dd if=/dev/virtualmachines/ubuntu910 of=$DEST/ubuntu910.mbr bs=512 count=1
partimage -d -M -b -z1 save /dev/mapper/virtualmachines-ubuntu910p1 $DEST/virtualmachines-ubuntu910p1.img
kpartx -dv /dev/virtualmachines/ubuntu910
# VM 18: Windows XP Home Edition SP3 32-bit HVM domU with VGA passthrough (requires Intel VT-d)
kpartx -av /dev/virtualmachines/winxphome32
dd if=/dev/virtualmachines/winxphome32 of=$DEST/winxphome32.mbr bs=512 count=1
partimage -d -M -b -z1 save /dev/mapper/virtualmachines-winxphome32p1 $DEST/virtualmachines-winxphome32p1.img
kpartx -dv /dev/virtualmachines/winxphome32
# EOF
</SCRIPT>
Thank you!