[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-users] How to Backup and Restore MBR within Logical Volumes?


  • To: xen-users@xxxxxxxxxxxxxxxxxxx, "Community assistance, encouragement, and advice for using Fedora." <fedora-list@xxxxxxxxxx>, Fedora Xen <fedora-xen@xxxxxxxxxx>
  • From: "Mr. Teo En Ming (Zhang Enming)" <space.time.universe@xxxxxxxxx>
  • Date: Thu, 12 Nov 2009 09:23:10 +0000
  • Cc: space.time.universe@xxxxxxxxx
  • Delivery-date: Thu, 12 Nov 2009 01:24:06 -0800
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:cc:content-type; b=m9M1V3jDLLBZY4eRRywbntHLTB1Od3+ykZ7zLiCktLbROJN7CQeQV2xp/WLbBrx9u0 XZg2SKi+2aHPUOgHO52pnLyWEaY5SRJR2D0nesgM14d4LStk9oCCR9ZvJNOmlVyb46HS /R/YNagfmfqiWl5QHOS6sWKOv5ZSvsBpOm3BY=
  • List-id: Xen user discussion <xen-users.lists.xensource.com>

Hi All,

I have several Xen virtual machines within logical volumes using LVM2. I did not use disk images for performance reasons.

Conventionally, if I want to clone my virtual machines, I have to dd the LV to an image file. But this consumes a lot of time and harddisk space.

So, instead of doing that, I want to use losetup and kpartx with my logical volumes, which contain operating systems of virtual machines.

I can backup the filesystems of a virtual machine in this way:

# losetup /dev/loop1 /dev/virtualmachines/windows7-x64

virtualmachines is the name of my volume group.

windows7-x64 is the logical volume.

# kpartx -av /dev/loop1

Then I would see the partitions of the virtual machine within a logical volume, like so:

/dev/mapper/loop1p1
/dev/mapper/loop1p2
/dev/mapper/loop1p3

Now that I can access the partitions of the virtual machine within a logical volume, I can use partimage or fsarchiver to backup the partitions (provided the filesystem is supported by the archiver).

But the problem is that I can only backup/clone the filesystems of my virtual machine within a logical volume. I can't backup the Master Boot Record (MBR) of the virtual machine within a logical volume. For example,

dd if=/dev/hda of=mbr.hda bs=512 count=1

Because /dev/hda resides in a logical volume. The logical volume is a virtual harddisk for my virtual machine.

I would like to know how to backup and also restore the MBR of my virtual machine/guest operating system/domU within a logical volume because the losetup and kpartx procedure only allows me access to the partitions, not the MBR. A complete backup of a virtual machine (and also a bare metal machine) includes the MBR and all filesystems.

If there is a catastrophic failure with my logical volumes containing domUs, I would like to

1) re-create the physical volume (PV)

2) re-create the volume group

3) assign the PV to the volume group

4) restore the LVM metadata, i.e. the configuration files for all the logical volumes

5) restore the MBR of my domU

6) restore the filesystems of my domU

Please advise.

Thank you very much.

--
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@xxxxxxxxx
Mobile Phone (Starhub Prepaid): +65-8369-2618
Street: Bedok Reservoir Road
Country: Singapore
_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-users

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.