WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-users

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

To: "Community assistance, encouragement, and advice for using Fedora." <fedora-list@xxxxxxxxxx>
Subject: [Xen-users] Re: How to Backup and Restore MBR within Logical Volumes?
From: "Bryn M. Reeves" <bmr@xxxxxxxxxx>
Date: Thu, 12 Nov 2009 10:45:39 +0000
Cc: xen-users@xxxxxxxxxxxxxxxxxxx, Fedora Xen <fedora-xen@xxxxxxxxxx>
Delivery-date: Thu, 12 Nov 2009 02:36:22 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <f712b9cf0911120123l685a1c53te4d0c7b7634b3e60@xxxxxxxxxxxxxx>
List-help: <mailto:xen-users-request@lists.xensource.com?subject=help>
List-id: Xen user discussion <xen-users.lists.xensource.com>
List-post: <mailto:xen-users@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=unsubscribe>
References: <f712b9cf0911120123l685a1c53te4d0c7b7634b3e60@xxxxxxxxxxxxxx>
Sender: xen-users-bounces@xxxxxxxxxxxxxxxxxxx
On Thu, 2009-11-12 at 09:23 +0000, Mr. Teo En Ming (Zhang Enming) wrote:
> 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

What's the point of adding a loopback device on top of the LV? Running
kpartx on the LV itself will work just fine and this just adds an
unnecessary layer of overhead and complexity unless I am missing
something.

> 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.

Assuming that the LV given above is a whole-disk image containing a DOS
MBR partition table:

dd if=/dev/virtualmachines/windows7-x64 of=/tmp.mbr.img bs=512 count=1

You could also do the same with the loopN device that you set up
earlier, although I still don't see the need for that step.

> 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

Should work fine, just be sure to test each step so that you are
confident and comfortable with it before you find yourself needing to do
this in anger.

Regards,
Bryn.



_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-users

<Prev in Thread] Current Thread [Next in Thread>