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

Mr. Teo En Ming (Zhang Enming) space.time.universe at gmail.com
Thu Nov 12 12:50:01 UTC 2009


On Thu, Nov 12, 2009 at 6:18 PM, Geert Janssens <info at kobaltwit.be> wrote:

> On Thursday 12 November 2009, you wrote:
> > > dd if=/dev/virtualmachines/windows7-x64 of=mbr.w7-x64 bs=512 count=1
> >
> > I think if you do this, you are only backing up the first 512 bytes of
> the
> > logical volume, not the MBR.
> >
> > Someone correct me if I am wrong.
>
> I did some tests just to be sure. As far as I can tell, dd interacts with
> lvm
> in exactly the same way as with a physical disk or a loop device.
>
> In the test I copied the first sector directly from the lvm partition or
> via
> the loop device. It results in exactly the same sector being copied.
>
> Also, if you try fdisk -l on the lvm disk or the loop device, it results in
> the same output.
>
> Below is the output from my tests:
>
> [root at aragorn:~]# losetup /dev/loop1 /dev/base/kobaltwit_f11_disk
>
> [root at aragorn:~]# fdisk -l /dev/base/kobaltwit_f11_disk
>
> Disk /dev/base/kobaltwit_f11_disk: 10.7 GB, 10737418240 bytes
> 255 heads, 63 sectors/track, 1305 cylinders
> Units = cylinders of 16065 * 512 = 8225280 bytes
>
>                        Device Boot      Start         End      Blocks   Id
> System
> /dev/base/kobaltwit_f11_disk1   *           1        1305    10482381   83
> Linux
> [root at aragorn:~]# fdisk -l /dev/base/kobaltwit_f11_disk
>
> Disk /dev/base/kobaltwit_f11_disk: 10.7 GB, 10737418240 bytes
> 255 heads, 63 sectors/track, 1305 cylinders
> Units = cylinders of 16065 * 512 = 8225280 bytes
>
>                        Device Boot      Start         End      Blocks   Id
> System
> /dev/base/kobaltwit_f11_disk1   *           1        1305    10482381   83
> Linux
>
> [root at aragorn:~]# dd if=/dev/base/kobaltwit_f11_disk of=mbr.lvm bs=512
> count=1
> 1+0 records in
> 1+0 records out
> 512 bytes (512 B) copied, 7.6e-05 seconds, 6.7 MB/s
>
> [root at aragorn:~]# dd if=/dev/loop1 of=mbr.loop bs=512 count=1
> 1+0 records in
> 1+0 records out
> 512 bytes (512 B) copied, 0.000151 seconds, 3.4 MB/s
>
> [root at aragorn:~]# diff mbr.l*
> [root at aragorn:~]#
>
> These test seem to indicate to me that the lvm layer in completely
> transparent
> to userland tools such as fdisk or dd.
>
> So I still think the losetup step is superfluous and possibly causing
> unnecessary overhead.
>
> Geert
>
> --
> Kobalt W.I.T.
> Web & Information Technology
> Brusselsesteenweg 152
> 1850 Grimbergen
>
> Tel  : +32 479 339 655
> Email: info at kobaltwit.be
>
>
Thank you!

I will omit the losetup step.

-- 
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 at gmail.com
Mobile Phone (Starhub Prepaid): +65-8369-2618
Street: Bedok Reservoir Road
Country: Singapore
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.fedoraproject.org/pipermail/users/attachments/20091112/1e6adcb8/attachment-0001.html 


More information about the users mailing list