0

I have created two image files (.img) of my two Hard disks which were RAID0. Now I need to copy MBR bytes from my image files in order copy them to mentioned hard disks, because I have re-created the RAID0 in those hard disks and now their MBR has faild.

Questions:

1) how can I Read and Copy MBR bytes from image files (.img)

2) Due to the RAID0 does it required MBR from both hard disks or just the first hard disk?

More info: My RAID0 had failed due a bluescreen crash and then I have created two images from my hard disks and then recreate the RAID0 but I has forgot to backup MBR before RAID0 recreation and its recreation caused the MBR changes. The only correct MBR (List of partitions) are in my image files.

Thank you

0

your MBR is stored on the first block of your disk, so you can grab it with dd (use a linux live CD if you are running windows).

Since you are using Raid0, be sure to check this howto for determining the physical order of the disks, and how to determine the location of your MBR.

I'd recommend you start with TestDisk, a partition recovery tool, which should be able to scan your media, identity the partitions, and write a new partition table for you.

failing that, an Intel MBR is 512B long, with the bootstrap code occupying the first 446, and partition table info following. this is important if you want to restore it to a disk with an existing partition table that does not match the disk the MBR came from. in that case you only want to restore the first bytes.

To Back the mbr up to File, use this command:

dd if=/dev/sda of=/tmp/mbrsda.bak bs=512 count=1

where /dev/sda is the disk you wish to backup from, and /tmp/mbrsda.bak is the file you wish to store it in. the command will take the first 512B block ('bs=512 count=1').

if you don't know the dev name of your disk, you can find out with fdisk -l.

  • As I said I want to read-copy MBR from disk-image file instead of Hard Disk, so dd will not help me! unless it can read from img file. – Hamid Nov 15 '13 at 19:56
  • you can always use a file for the if parameter. dd if=/tmp/img1.img of=/tmp/mbr.bak bs=512 count=1 DD can be a dangerous tool if used incorrectly, so read up a little before proceeding. linux.die.net/man/1/dd – Frank Thomas Nov 15 '13 at 20:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.