<div class="gmail_quote"><div><div class="h5"><div class="gmail_quote">On Fri, Nov 13, 2009 at 1:25 PM, Mr. Teo En Ming (Zhang Enming) <span dir="ltr"><<a href="mailto:space.time.universe@gmail.com" target="_blank">space.time.universe@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div><br><br><div class="gmail_quote">On Fri, Nov 13, 2009 at 11:17 AM, Mr. Teo En Ming (Zhang Enming) <span dir="ltr"><<a href="mailto:space.time.universe@gmail.com" target="_blank">space.time.universe@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br><br><div class="gmail_quote"><div><div></div><div>On Fri, Nov 13, 2009 at 5:40 AM, Sergey Vlasov <span dir="ltr"><<a href="mailto:vsu@altlinux.ru" target="_blank">vsu@altlinux.ru</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div>
On Fri, Nov 13, 2009 at 12:57:22AM +0800, Mr. Teo En Ming (Zhang Enming) wrote:<br>
[...]<br>
<div>> # VM 11: Rocks 5.1 x86_64 HPC Compute Cluster HVM domU<br>
><br>
> kpartx -av /dev/virtualmachines/rocks0001<br>
><br>
> dd if=/dev/virtualmachines/rocks0001 of=$DEST/rocks0001.mbr bs=512 count=1<br>
><br>
> partimage -d -M -b -z1 save /dev/mapper/virtualmachines-rocks0001p1<br>
> $DEST/virtualmachines-rocks0001p1.img<br>
><br>
> partimage -d -M -b -z1 save /dev/mapper/virtualmachines-rocks0001p2<br>
> $DEST/virtualmachines-rocks0001p2.img<br>
><br>
> partimage -d -M -b -z1 save /dev/mapper/virtualmachines-rocks0001p5<br>
> $DEST/virtualmachines-rocks0001p5.img<br>
<br>
</div>Note that this VM (and some other VMs listed in your script) uses<br>
logical partitions.  In this case just saving a copy of MBR will not<br>
be enough to save partition layout - MBR describes only 4 primary<br>
partitions, and restoring just MBR will not restore extended<br>
partitions.<br>
<br>
One way to backup the complete partition layout is by saving also<br>
the output of "sfdisk -d $device"; the resulting file can be used as<br>
input to sfdisk to restore all partitions, including logical ones.<br>
Saving MBR is still needed together with sfdisk, because it saves<br>
the boot code (used for HVM) and CHS geometry information (which can<br>
be used during boot in some cases).<br>
<br></div></div>-----BEGIN PGP SIGNATURE-----<br>
Version: GnuPG v1.4.10 (GNU/Linux)<br>
<br>
iEYEARECAAYFAkr8gM8ACgkQW82GfkQfsqLa+QCaAqpO5NWhYHtKVi3M5ytERw27<br>
eC0AnjsJuG34MAR1jZRejBiJCVybQvc1<br>
=RRGH<br>
-----END PGP SIGNATURE-----<div><br>
<br>_______________________________________________<br>
Xen-users mailing list<br>
<a href="mailto:Xen-users@lists.xensource.com" target="_blank">Xen-users@lists.xensource.com</a><br>
<a href="http://lists.xensource.com/xen-users" target="_blank">http://lists.xensource.com/xen-users</a><br></div></blockquote></div><br><br><br>Thank you for pointing this out. Otherwise I would made incomplete backups.<br>


<br>
Would it be best practice to always backup both the MBR and the partition geometry using sfdisk whenever cloning our harddisks on desktops and servers?<br><br>Besides sfdisk, there are also other partitioning tools like fdisk, cfdisk, and parted.<br>



<br>Could these other tools also be used for backing up the partition geometry like sfdisk?<br><br>Thank you.<div><div></div><div><br clear="all"><br>-- <br>Mr. Teo En Ming (Zhang Enming) Dip(Mechatronics) BEng(Hons)(Mechanical Engineering)<br>



Alma Maters:<br>(1) Singapore Polytechnic<br>(2) National University of Singapore<br>My Primary Blog: <a href="http://teo-en-ming-aka-zhang-enming.blogspot.com" target="_blank">http://teo-en-ming-aka-zhang-enming.blogspot.com</a><br>


My Secondary Blog: <a href="http://enmingteo.wordpress.com" target="_blank">http://enmingteo.wordpress.com</a><br>
My Youtube videos: <a href="http://www.youtube.com/user/enmingteo" target="_blank">http://www.youtube.com/user/enmingteo</a><br>Email: <a href="mailto:space.time.universe@gmail.com" target="_blank">space.time.universe@gmail.com</a><br>


Mobile Phone (Starhub Prepaid): +65-8369-2618<br>
Street: Bedok Reservoir Road<br>Country: Singapore<br>
</div></div></blockquote></div><br></div></div>Hi,<br><br>I have made some improvements to the backup/cloning script. Please help me to vet it through for any mistakes. Thank you very much!<div><br><br><SCRIPT></div>
</blockquote><div>    ---SNIPPED--- <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div></SCRIPT><br><br></div><div><div></div>
<div>-- <br>Mr. Teo En Ming (Zhang Enming) Dip(Mechatronics) BEng(Hons)(Mechanical Engineering)<br>

Alma Maters:<br>(1) Singapore Polytechnic<br>(2) National University of Singapore<br>My Primary Blog: <a href="http://teo-en-ming-aka-zhang-enming.blogspot.com" target="_blank">http://teo-en-ming-aka-zhang-enming.blogspot.com</a><br>

My Secondary Blog: <a href="http://enmingteo.wordpress.com" target="_blank">http://enmingteo.wordpress.com</a><br>
My Youtube videos: <a href="http://www.youtube.com/user/enmingteo" target="_blank">http://www.youtube.com/user/enmingteo</a><br>Email: <a href="mailto:space.time.universe@gmail.com" target="_blank">space.time.universe@gmail.com</a><br>

Mobile Phone (Starhub Prepaid): +65-8369-2618<br>
Street: Bedok Reservoir Road<br>Country: Singapore<br>
</div></div></blockquote></div><br></div></div>Hi All,<br><br>This is the final version of my backup script. I have gone through the script once to make sure there are no mistakes. If I want to capture any errors during the execution of the backup/cloning script, which of the following commands do I run?<br>

<br># ./backup-script.sh > backup.log<br><br>OR <br><br># ./backup-script.sh 2> backup.log<br><br>After completing the backup script, I will proceed to write the restore script.<br><br>If there are any errors, please let me know because I do not want to make any mistakes with the cloning process. Thank you.<br>

<br><SCRIPT><br><font size="1"><div class="im">#!/bin/sh<br><br>###############################################################################################################<br>###############################################################################################################<br>

# Script to Backup/Clone Xen Host/Dom0 and all DomUs which are using Logical Volumes as Virtual Hard Disks<br>###############################################################################################################<br>

###############################################################################################################<br><br># Written by:<br> <br># Mr. Teo En Ming (Zhang Enming) Dip(Mechatronics) BEng(Hons)(Mechanical Engineering)<br>

# Alma Maters:<br># (1) Singapore Polytechnic<br># (2) National University of Singapore<br># Primary Blog: <a href="http://teo-en-ming-aka-zhang-enming.blogspot.com" target="_blank">http://teo-en-ming-aka-zhang-enming.blogspot.com</a><br>

# Secondary Blog: <a href="http://enmingteo.wordpress.com" target="_blank">http://enmingteo.wordpress.com</a><br># Youtube Videos: <a href="http://www.youtube.com/user/enmingteo" target="_blank">http://www.youtube.com/user/enmingteo</a><br>
# Xen Tutorials and Video Demos: <a href="http://www.xen.org/support/tutorial.html" target="_blank">http://www.xen.org/support/tutorial.html</a><br>
# Email: <a href="mailto:space.time.universe@gmail.com" target="_blank">space.time.universe@gmail.com</a><br># MSN: <a href="mailto:teoenming@hotmail.com" target="_blank">teoenming@hotmail.com</a><br># Mobile Phone (Starhub Prepaid): +65-8369-2618<br>
# Street: Bedok Reservoir Road<br>
# Country: Singapore<br><br># First written: 13 November 2009 Friday 12:38 A.M. Singapore time<br># Last updated: 13 November 2009 Friday 12:38 A.M. Singapore time<br># Last updated: 13 November 2009 Friday 1:20 P.M. Singapore time<br>
</div>
# Last updated: 13 November 2009 Friday 5:23 P.M. Singapore time<div class="im"><br><br># REFERNCE: "Geek Sheet: Bare-metal backup and recovery", May 7th, 2008, Jason Perlow<br># URL: <a href="http://blogs.zdnet.com/BTL/?p=8759" target="_blank">http://blogs.zdnet.com/BTL/?p=8759</a><br>

<br># Usage Instructions:<br><br># Boot up your desktop/server with System Rescue CD version 1.3.2 for i386/amd64. <br># Then execute this backup script. You need to adapt this script to work for your environment.<br># Download System Rescue CD from <a href="http://www.sysresccd.org/Main_Page" target="_blank">http://www.sysresccd.org/Main_Page</a><br>

<br># FAQ<br># Q: Why do I want to write this cloning script when there are many open source cloning software available?<br># A: I am previously using Clonezilla. It is a very good cloning software. However, it could not detect all the<br>

#    virtual machines in my LVM2 logical volumes and had to fall back on using dd to image all my domUs,<br>#    which resulted in an enormous 300 GB (!) backup image set and an extremely lengthy cloning process of <br>#    7 hours. Clonezilla is very good for LVs which only contain filesystems, but not for LVs which contain<br>

#    virtual machines with MBR, partition geometries and full fledged operating systems. It is very diffcult<br>#    to image nested logical volumes, i.e. logical volumes within logical volumes. And the PV within a LV is <br>

#    the barrier. So it is not Clonezilla's fault. Anybody who knows how to activate all the logical volumes<br>#    of all the volume groups within LVM2 physical volumes inside a logical volume hosting a virtual machine,<br>

#    please share your knowledge with me. Thank you very much.<br><br></div># No. of QC Checks Performed on this backup script: 1 <br><div class="im"><br>###############################################################################################################<br>

# Declare Variables<br>###############################################################################################################<br><br>HARDDISK=/dev/sda<br>DEST=/media/hitachi/test<br>FSA_COMPLEVEL=9<br>PROCESSOR_CORES=2<br>

GZIP_COMPLEVEL=fast<br>PARTIMAGE_COMPLEVEL=1<br><br>###############################################################################################################<br># Create Storage Directory for Backup Images<br>###############################################################################################################<br>

<br>if [ ! -d $DEST ]<br>then<br>    mkdir -p $DEST<br>fi<br><br>###############################################################################################################<br>###############################################################################################################<br>

# Cloning Xen Host/Dom0<br>###############################################################################################################<br>###############################################################################################################<br>

<br># Backup MBR<br><br>dd if=$HARDDISK of=$DEST/f11-xen-dom0-sda.mbr bs=512 count=1<br><br># Backup Partition Geometry<br>sfdisk -d $HARDDISK > $DEST/f11-xen-dom0-partition-geometry-sda.sfdisk<br><br># Activate all logical volumes in all volume groups<br>

<br>vgchange -ay<br><br># Backup UUIDs of PVs<br><br>pvdisplay > $DEST/f11-xen-dom0-pvdisplay.txt<br><br></div># Backup LVM2 Metadata for All Volume Groups<div class="im"><br><br># Backup the configuration of dedicated volume group for dom0<br>

<br>vgcfgbackup -d -v vg_fedora11_host -f $DEST/vg_fedora11_host-vgcfg.lvm2.metadata<br><br># Backup the configuration of dedicated volume group for domUs<br><br>vgcfgbackup -d -v virtualmachines -f $DEST/virtualmachines-vgcfg.lvm2.metadata<br>

<br># Backup /boot partition and all logical volumes of dedicated volume group for host/dom0<br><br>fsarchiver savefs -v -z $FSA_COMPLEVEL -j $PROCESSOR_CORES $DEST/f11-xen-dom0-filesystems.fsa /dev/sda1 \<br>/dev/vg_fedora11_host/lv_home /dev/vg_fedora11_host/lv_root /dev/vg_fedora11_host/lv_var<br>

<br>###############################################################################################################<br>###############################################################################################################<br>

# Cloning Xen-based Virtual Machines/DomUs/Guest Operating Systems/VMs<br>###############################################################################################################<br>###############################################################################################################<br>

<br># The following 8 virtual machines have LVM2 physical volumes, so it is not possible to image using partimage <br># or fsarchiver directly, as both do not support PVs.  The only convenient way is to image the logical volume   <br>

# for the VM using dd, ie. sector by sector copy, and then piping it to gzip for a smaller backup image. <br># Other methods would have been more involved and tedious.<br><br></div># VM 1: Fedora 11 x86_64 PV domU (MPICH2 Virtual Supercomputer Center)<div class="im">
<br>
###############################################################################################################<br><br># Sector by sector copy<br>dd if=/dev/virtualmachines/f11-pv-hpc-node0001 | gzip --$GZIP_COMPLEVEL > \<br>
</div>
$DEST/virtualmachines-f11-pv-hpc-node0001.img.gz<br><br># VM 2: Fedora 11 x86_64 PV domU (MPICH2 Virtual Supercomputer Center)<div class="im"><br>###############################################################################################################<br>

<br># Sector by sector copy<br>dd if=/dev/virtualmachines/f11-pv-hpc-node0002 | gzip --$GZIP_COMPLEVEL > \<br></div>$DEST/virtualmachines-f11-pv-hpc-node0002.img.gz<br><br># VM 3: Fedora 11 x86_64 PV domU (MPICH2 Virtual Supercomputer Center)<div class="im">
<br>
###############################################################################################################<br><br># Sector by sector copy<br>dd if=/dev/virtualmachines/f11-pv-hpc-node0003 | gzip --$GZIP_COMPLEVEL > \<br>
</div>
$DEST/virtualmachines-f11-pv-hpc-node0003.img.gz<br><br># VM 4: Fedora 11 x86_64 PV domU (MPICH2 Virtual Supercomputer Center)<div class="im"><br>###############################################################################################################<br>

<br># Sector by sector copy<br>dd if=/dev/virtualmachines/f11-pv-hpc-node0004 | gzip --$GZIP_COMPLEVEL > \<br></div>$DEST/virtualmachines-f11-pv-hpc-node0004.img.gz<br><br># VM 5: Fedora 11 x86_64 PV domU (MPICH2 Virtual Supercomputer Center)<div class="im">
<br>
###############################################################################################################<br><br># Sector by sector copy<br>dd if=/dev/virtualmachines/f11-pv-hpc-node0005 | gzip --$GZIP_COMPLEVEL > \<br>
</div>
$DEST/virtualmachines-f11-pv-hpc-node0005.img.gz<br><br># VM 6: Fedora 11 x86_64 PV domU (MPICH2 Virtual Supercomputer Center)<div class="im"><br>###############################################################################################################<br>

<br># Sector by sector copy<br>dd if=/dev/virtualmachines/f11-pv-hpc-node0006 | gzip --$GZIP_COMPLEVEL > \<br></div>$DEST/virtualmachines-f11-pv-hpc-node0006.img.gz<br><br># VM 7: Fedora 11 x86_64 PV domU (MPICH2 Virtual Supercomputer Center)<div class="im">
<br>
###############################################################################################################<br><br># Sector by sector copy<br>dd if=/dev/virtualmachines/f11-pv-hpc-node0007 | gzip --$GZIP_COMPLEVEL > \<br>
</div>
$DEST/virtualmachines-f11-pv-hpc-node0007.img.gz<br><br># VM 8: Fedora 11 x86_64 PV domU (MPICH2 Virtual Supercomputer Center)<div class="im"><br>###############################################################################################################<br>

<br># Sector by sector copy<br>dd if=/dev/virtualmachines/f11-pv-hpc-node0008 | gzip --$GZIP_COMPLEVEL > \<br></div>$DEST/virtualmachines-f11-pv-hpc-node0008.img.gz<div class="im"><br><br># VM 9: FreeBSD 8.0 RC2 UNIX amd64 HVM domU<br>
###############################################################################################################<br>
<br># Sector by sector copy<br>dd if=/dev/virtualmachines/freebsd | gzip --$GZIP_COMPLEVEL > \<br></div>$DEST/virtualmachines-freebsd.img.gz<div class="im"><br><br># VM 10: OpenSolaris 2009.06 UNIX amd64 PV domU<br>###############################################################################################################<br>

<br># Sector by sector copy<br>dd if=/dev/virtualmachines/opensolaris | gzip --$GZIP_COMPLEVEL > \<br></div>$DEST/virtualmachines-opensolaris.img.gz<br><br># VM 11: Rocks 5.1 x86_64 HPC Compute Cluster HVM domU (based on CentOS 5.2)<div class="im">
<br>
###############################################################################################################<br><br># Add partition mappings in /dev/mapper<br>kpartx -av /dev/virtualmachines/rocks0001<br><br># Backup MBR<br>

dd if=/dev/virtualmachines/rocks0001 of=$DEST/virtualmachines-rocks0001.mbr bs=512 count=1<br><br># Backup Partition Geometry<br>sfdisk -d /dev/virtualmachines/rocks0001 > $DEST/virtualmachines-rocks0001.sfdisk<br><br>

# Backup Filesystems<br>partimage -d -M -b -z$PARTIMAGE_COMPLEVEL save /dev/mapper/virtualmachines-rocks0001p1 \<br>$DEST/virtualmachines-rocks0001p1.img<br><br>partimage -d -M -b -z$PARTIMAGE_COMPLEVEL save /dev/mapper/virtualmachines-rocks0001p2 \<br>

$DEST/virtualmachines-rocks0001p2.img<br><br>partimage -d -M -b -z$PARTIMAGE_COMPLEVEL save /dev/mapper/virtualmachines-rocks0001p5 \<br>$DEST/virtualmachines-rocks0001p5.img<br><br># Delete partition mappings in /dev/mapper<br>

kpartx -dv /dev/virtualmachines/rocks0001<br><br></div># VM 12: Rocks 5.1 x86_64 HPC Compute Cluster HVM domU (based on CentOS 5.2)<div class="im"><br>###############################################################################################################<br>

<br># Add partition mappings in /dev/mapper<br>kpartx -av /dev/virtualmachines/rocks0002<br><br># Backup MBR<br>dd if=/dev/virtualmachines/rocks0002 of=$DEST/virtualmachines-rocks0002.mbr bs=512 count=1<br><br># Backup Partition Geometry<br>

sfdisk -d /dev/virtualmachines/rocks0002 > $DEST/virtualmachines-rocks0002.sfdisk<br><br># Backup Filesystems<br>partimage -d -M -b -z$PARTIMAGE_COMPLEVEL save /dev/mapper/virtualmachines-rocks0002p1 \<br>$DEST/virtualmachines-rocks0002p1.img<br>

<br>partimage -d -M -b -z$PARTIMAGE_COMPLEVEL save /dev/mapper/virtualmachines-rocks0002p2 \<br>$DEST/virtualmachines-rocks0002p2.img<br><br>partimage -d -M -b -z$PARTIMAGE_COMPLEVEL save /dev/mapper/virtualmachines-rocks0002p5 \<br>

$DEST/virtualmachines-rocks0002p5.img<br><br># Delete partition mappings in /dev/mapper<br>kpartx -dv /dev/virtualmachines/rocks0002<br><br></div># VM 13: Rocks 5.1 x86_64 HPC Compute Cluster HVM domU (based on CentOS 5.2)<div class="im">
<br>###############################################################################################################<br>
<br># Add partition mappings in /dev/mapper<br>kpartx -av /dev/virtualmachines/rocks0003<br><br># Backup MBR<br>dd if=/dev/virtualmachines/rocks0003 of=$DEST/virtualmachines-rocks0003.mbr bs=512 count=1<br><br># Backup Partition Geometry<br>

sfdisk -d /dev/virtualmachines/rocks0003 > $DEST/virtualmachines-rocks0003.sfdisk<br><br># Backup Filesystems<br>partimage -d -M -b -z$PARTIMAGE_COMPLEVEL save /dev/mapper/virtualmachines-rocks0003p1 \<br>$DEST/virtualmachines-rocks0003p1.img<br>

<br>partimage -d -M -b -z$PARTIMAGE_COMPLEVEL save /dev/mapper/virtualmachines-rocks0003p2 \<br>$DEST/virtualmachines-rocks0003p2.img<br><br>partimage -d -M -b -z$PARTIMAGE_COMPLEVEL save /dev/mapper/virtualmachines-rocks0003p5 \<br>

$DEST/virtualmachines-rocks0003p5.img<br><br># Delete partition mappings in /dev/mapper<br>kpartx -dv /dev/virtualmachines/rocks0003<br><br></div># VM 14: Rocks 5.1 x86_64 HPC Compute Cluster HVM domU (based on CentOS 5.2)<div class="im">
<br>###############################################################################################################<br>
<br># Add partition mappings in /dev/mapper<br>kpartx -av /dev/virtualmachines/rocks0004<br><br># Backup MBR<br>dd if=/dev/virtualmachines/rocks0004 of=$DEST/virtualmachines-rocks0004.mbr bs=512 count=1<br><br># Backup Partition Geometry<br>

sfdisk -d /dev/virtualmachines/rocks0004 > $DEST/virtualmachines-rocks0004.sfdisk<br><br># Backup Filesystems<br>partimage -d -M -b -z$PARTIMAGE_COMPLEVEL save /dev/mapper/virtualmachines-rocks0004p1 \<br>$DEST/virtualmachines-rocks0004p1.img<br>

<br>partimage -d -M -b -z$PARTIMAGE_COMPLEVEL save /dev/mapper/virtualmachines-rocks0004p2 \<br>$DEST/virtualmachines-rocks0004p2.img<br><br>partimage -d -M -b -z$PARTIMAGE_COMPLEVEL save /dev/mapper/virtualmachines-rocks0004p5 \<br>

$DEST/virtualmachines-rocks0004p5.img<br><br># Delete partition mappings in /dev/mapper<br>kpartx -dv /dev/virtualmachines/rocks0004<br><br></div># VM 15: Rocks 5.1 x86_64 HPC Compute Cluster HVM domU (based on CentOS 5.2)<div>
<div></div><div class="h5"><br>###############################################################################################################<br>
<br># Add partition mappings in /dev/mapper<br>kpartx -av /dev/virtualmachines/rocks0005<br><br># Backup MBR<br>dd if=/dev/virtualmachines/rocks0005 of=$DEST/virtualmachines-rocks0005.mbr bs=512 count=1<br><br># Backup Partition Geometry<br>

sfdisk -d /dev/virtualmachines/rocks0005 > $DEST/virtualmachines-rocks0005.sfdisk<br><br># Backup Filesystems<br>partimage -d -M -b -z$PARTIMAGE_COMPLEVEL save /dev/mapper/virtualmachines-rocks0005p1 \<br>$DEST/virtualmachines-rocks0005p1.img<br>

<br>partimage -d -M -b -z$PARTIMAGE_COMPLEVEL save /dev/mapper/virtualmachines-rocks0005p2 \<br>$DEST/virtualmachines-rocks0005p2.img<br><br>partimage -d -M -b -z$PARTIMAGE_COMPLEVEL save /dev/mapper/virtualmachines-rocks0005p5 \<br>

$DEST/virtualmachines-rocks0005p5.img<br><br># Delete partition mappings in /dev/mapper<br>kpartx -dv /dev/virtualmachines/rocks0005<br><br># VM 16: Slackware64 13.0 amd64 HVM domU<br>###############################################################################################################<br>

<br># Add partition mappings in /dev/mapper<br>kpartx -av /dev/virtualmachines/slackware64<br><br># Backup MBR<br>dd if=/dev/virtualmachines/slackware64 of=$DEST/virtualmachines-slackware64.mbr bs=512 count=1<br><br># Backup Partition Geometry<br>

sfdisk -d /dev/virtualmachines/slackware64 > $DEST/virtualmachines-slackware64.sfdisk<br><br># Backup Filesystems<br>partimage -d -M -b -z$PARTIMAGE_COMPLEVEL save /dev/mapper/virtualmachines-slackware64p1 \<br>$DEST/virtualmachines-slackware64p1.img<br>

<br>partimage -d -M -b -z$PARTIMAGE_COMPLEVEL save /dev/mapper/virtualmachines-slackware64p2 \<br>$DEST/virtualmachines-slackware64p2.img<br><br># Delete partition mappings in /dev/mapper<br>kpartx -dv /dev/virtualmachines/slackware64<br>

<br># VM 17: Ubuntu 9.10 Karmic Koala Linux HVM domU<br>###############################################################################################################<br><br># Add partition mappings in /dev/mapper<br>kpartx -av /dev/virtualmachines/ubuntu910<br>

<br># Backup MBR<br>dd if=/dev/virtualmachines/ubuntu910 of=$DEST/virtualmachines-ubuntu910.mbr bs=512 count=1<br><br># Backup Partition Geometry<br>sfdisk -d /dev/virtualmachines/ubuntu910 > $DEST/virtualmachines-ubuntu910.sfdisk<br>

<br># Backup Filesystems<br>partimage -d -M -b -z$PARTIMAGE_COMPLEVEL save /dev/mapper/virtualmachines-ubuntu910p1 \<br>$DEST/virtualmachines-ubuntu910p1.img<br><br># Delete partition mappings in /dev/mapper<br>kpartx -dv /dev/virtualmachines/ubuntu910<br>

<br># VM 18: Windows XP Home Edition SP3 32-bit HVM domU with VGA passthrough (requires Intel VT-d)<br>###############################################################################################################<br><br>

# Add partition mappings in /dev/mapper<br>kpartx -av /dev/virtualmachines/winxphome32<br><br># Backup MBR<br>dd if=/dev/virtualmachines/winxphome32 of=$DEST/virtualmachines-winxphome32.mbr bs=512 count=1<br><br># Backup Partition Geometry<br>

sfdisk -d /dev/virtualmachines/winxphome32 > $DEST/virtualmachines-winxphome32.sfdisk<br><br># Backup Filesystems<br>partimage -d -M -b -z$PARTIMAGE_COMPLEVEL save /dev/mapper/virtualmachines-winxphome32p1 \<br>$DEST/virtualmachines-winxphome32p1.img<br>

<br># Delete partition mappings in /dev/mapper<br>kpartx -dv /dev/virtualmachines/winxphome32<br><br>###############################################################################################################<br># EOF<br>

###############################################################################################################</div></div></font><div><div></div><div class="h5"><br></SCRIPT><br><br>-- <br>Mr. Teo En Ming (Zhang Enming) Dip(Mechatronics) BEng(Hons)(Mechanical Engineering)<br>

Alma Maters:<br>(1) Singapore Polytechnic<br>(2) National University of Singapore<br>My Primary Blog: <a href="http://teo-en-ming-aka-zhang-enming.blogspot.com" target="_blank">http://teo-en-ming-aka-zhang-enming.blogspot.com</a><br>
My Secondary Blog: <a href="http://enmingteo.wordpress.com" target="_blank">http://enmingteo.wordpress.com</a><br>
My Youtube videos: <a href="http://www.youtube.com/user/enmingteo" target="_blank">http://www.youtube.com/user/enmingteo</a><br>Email: <a href="mailto:space.time.universe@gmail.com" target="_blank">space.time.universe@gmail.com</a><br>
Mobile Phone (Starhub Prepaid): +65-8369-2618<br>
Street: Bedok Reservoir Road<br>Country: Singapore<br>
</div></div></div>