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: "Mr. Teo En Ming (Zhang Enming)" <space.time.universe@xxxxxxxxx>
Date: Thu, 12 Nov 2009 12:32:22 +0000
Cc: space.time.universe@xxxxxxxxx, xen-users@xxxxxxxxxxxxxxxxxxx, Fedora Xen <fedora-xen@xxxxxxxxxx>
Delivery-date: Thu, 12 Nov 2009 04:33:31 -0800
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=JdslMgWwFBU3kQ9CWnAcbuYreR1GgfX+28WHHrxv324=; b=a0FkMlth55EFH1qdWRIyfvSVefQL8bWt2/B19HhCS0VJjTA/RQ0mTmospCcAtYLZj1 OEE8A8XahK4+uBsw8Nvyo6jbiZzyeEjMhI9QSo3btPFbHX7lkNEcmsucOtC4MDxHi6jC dst29L8F4Z5qZn5nXk5RczcERIBtnD1quu5o8=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=X1z7VPMuqUOCDdOmMldsq8lodGjPJNCFESP0y3ZdbF9uoUiXeXjnZ/ZYtIang9A3Ih OhG9wQY3esdvXzVLQbwj0VrHDywzTp6jazJM0WaI4GrRsnezOD9YxAvj8FCPXqDP1TXG HtljB2txAkciK07lVIq/n9CSUT55KXuDeeZBg=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <f712b9cf0911120255r74939302o9bd25ddcde5d78dd@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> <1258022739.30675.139.camel@xxxxxxxxxxxxxxxxxxxxxx> <f712b9cf0911120255r74939302o9bd25ddcde5d78dd@xxxxxxxxxxxxxx>
Sender: xen-users-bounces@xxxxxxxxxxxxxxxxxxx


On Thu, Nov 12, 2009 at 10:55 AM, Mr. Teo En Ming (Zhang Enming) <space.time.universe@xxxxxxxxx> wrote:


On Thu, Nov 12, 2009 at 10:45 AM, Bryn M. Reeves <bmr@xxxxxxxxxx> wrote:
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.


--

Hi Bryn,

I have just tried an experiment without the losetup step. I have verified that it works using kpartx only.

root@sysresccd /root % kpartx -av /dev/virtualmachines/winxphome32
add map virtualmachines-winxphome32p1 (253:22): 0 104840127 linear /dev/virtualmachines/winxphome32 63
root@sysresccd /root % cd /dev/mapper
root@sysresccd /dev/mapper % ls *winxphome32*
virtualmachines-winxphome32  virtualmachines-winxphome32p1
root@sysresccd /dev/mapper % ls -al *winxphome32*
brw-rw---- 1 root disk 253,  0 2009-11-12 15:49 virtualmachines-winxphome32
brw-rw---- 1 root disk 253, 22 2009-11-12 18:47 virtualmachines-winxphome32p1
root@sysresccd /dev/mapper % ls -al *winxphome32*
brw-rw---- 1 root disk 253,  0 2009-11-12 15:49 virtualmachines-winxphome32
brw-rw---- 1 root disk 253, 22 2009-11-12 18:47 virtualmachines-winxphome32p1
root@sysresccd /dev/mapper % fdisk -l virtualmachines-winxphome32

Disk virtualmachines-winxphome32: 53.7 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x2b362b35


                       Device Boot      Start         End      Blocks   Id  System
virtualmachines-winxphome32p1   *           1        6526    52420063+   7  HPFS/NTFS

Without the losetup and the corresponding overhead, it will speed up cloning of my virtual machines within LVs.



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

Hi All,

I have performed a backup of my F11 Dom0's PV (60 GB) of 3 logical volumes using fsarchiver with the maximum possible LZMA compression. The operation took 4 hours with 2 compression threads. The resulting backup archive size is 8.1 GB for a PV of 60 GB.

My hardware specs:

Intel Pentium Dual Core E6300 2.8 GHz
Intel Desktop Board DQ45CB
6 GB DDR2-800 memory

--
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
<Prev in Thread] Current Thread [Next in Thread>