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



On Thu, Nov 12, 2009 at 6:18 PM, Geert Janssens <info@xxxxxxxxxxxx> 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@aragorn:~]# losetup /dev/loop1 /dev/base/kobaltwit_f11_disk

[root@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@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@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@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@aragorn:~]# diff mbr.l*
[root@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@xxxxxxxxxxxx


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@xxxxxxxxx
Mobile Phone (Starhub Prepaid): +65-8369-2618
Street: Bedok Reservoir Road
Country: Singapore
--
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines

Relevant Pages

  • Re: smartd error messages: OfflineUncorrectableSector, CurrentPendingSector
    ... Okay, on the stuff below, I used lvdisplay -m to show the extents. ... my /var/tmp volume by subtracting out the starting sector of the LVM ... partition, and then forget about the bad sector and not use LVM next ...
    (Fedora)
  • Re: How to use lilo on a file
    ... The target for the boot sector is /dev/loop0. ... Well, that's wrong for a start, since the image is on your loop device, ... But the bios can't boot the loop device, ...
    (comp.os.linux.misc)
  • Re: FDISK -> LVM question
    ... Windows' driver letter naming. ... OS/2 (with LVM) stores the information in previously unused sectors. ... for all the primaries on a disk, located at the last sector of the MBR track. ...
    (comp.os.os2.setup.storage)
  • Re: cloning with dd
    ... >> sector of the hard disk, whether or not it has data on it. ... > does not support LVM. ... I was planning on using LVM for these new boxes ...
    (alt.os.linux)
  • Re: SMART errors - are they for real? or, BIOS weirdness?
    ... can't reallocate them. ... and then rewrite that sector (actually ... I had a system using LVM fail to boot, ... got error reports like the above. ...
    (Fedora)