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: [Fedora-xen] How to Backup and Restore MBR within Logica

To: Veli-Pekka Kestilä <fedora@xxxxxxxxx>
Subject: [Xen-users] Re: [Fedora-xen] 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 10:01:12 +0000
Cc: "Community assistance, encouragement, and advice for using Fedora." <fedora-list@xxxxxxxxxx>, space.time.universe@xxxxxxxxx, xen-users@xxxxxxxxxxxxxxxxxxx, Fedora Xen <fedora-xen@xxxxxxxxxx>
Delivery-date: Thu, 12 Nov 2009 02:02:17 -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=ZAeh/La5gDdseD1eeWE9yfpHVVsYNRpGWiuXZzs0hUY=; b=nIQ0Rephf6l4Q4N7vzJnGXfx0FceHHJ/jIhj9LxPN33B/LceSqpC8J9VY8aOdAZq8I rxQbbfj0DLkG0CXyalQ451h+GZzdImqdcJLfNjEzse4QifKb+wZ8vYUsqb0CBj8zg2vp FKHBbdU4qvpoT3+h26T7Rc7vdXxODR/J+lVX0=
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=FYyR1UOAovNKhjv96lOgvvLqTFjy8LXRtQVaPXdVWpYOOPbkj55WADR9wNhZfTeHzC RmhLy2jt04p6grsgJ4zA4u5RHSq+8UVYS1mvTsYFyAw0dHeoOSLSVS315pGHGyDrZtAP YUDPBPLN26/+VcsKW+U95xmuWwEfC7lUzETH4=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <4AFBDABE.1020803@xxxxxxxxx>
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> <4AFBDABE.1020803@xxxxxxxxx>
Sender: xen-users-bounces@xxxxxxxxxxxxxxxxxxx
Thank you for your advice!

Is it called LVM snapshot?

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

2009/11/12 Veli-Pekka Kestilä <fedora@xxxxxxxxx>
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.

# losetup /dev/loop1 /dev/virtualmachines/windows7-x64
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.
You can do dd if=/dev/dev/loop1 of=mbr.dha bs=512 count=1 to make the copy of the boot block.


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

Of these steps you can recreate 1,2,3 and 4 just by keeping records of their parameters and using normal fdisk, pvcreate, vgcreate and lvcreate commands.

For the things inside of lvm you can use losetup to make the loopback device out of the lv where you want to install the quest operating system and then recreate mbr from the file. Problem probably is how to recreate the filesystems if your backup software cannot do it. Also with windows protected system files can be a problem if backup software doesn't support them.

One thing you could of course do is to make the system restore backup inside of the DomU when it's running. And then boot new DomU when starting up and use the system backup to restore. (of course this is still more work that pure dd from one place to another.)

Problem is that everything else than using dd can have it fair share of problems. If the domU can't be offline too long, you could allocate more space and use the lvm:s instant cloning features (can't remember the name just now. ) and then use dd with gzip or bzip to make the backup from this clone to keep the space requirements minimum for the stored copies. And have minimum disruption for the DomU.

-vpk

--
Fedora-xen mailing list
Fedora-xen@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/fedora-xen




_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-users
<Prev in Thread] Current Thread [Next in Thread>