restoring MBR on linux drive using GRUB

Discussion in 'Operating Systems' started by ron7000, Mar 27, 2014.

  1. ron7000

    ron7000 Master Guru

    Messages:
    238
    Likes Received:
    0
    GPU:
    MSI 4G GTX970
    I'm trying to clone linux disks but run into a MBR problem.
    what i have is a tar file of a working linux os, SLES 11 with Grub boot loader.
    on a separate working system, i slave and mount a new hard drive as /dev/sdb.
    i format /dev/sdb1 as swap 1 gb in size.
    i format /dev/sdb2 as ext3 rest of hard drive, and mount as /newdisk.
    cd /newdisk
    tar -xf /root/linuxsystem.tar
    unmount /newdisk.

    now when i take this newly created disk and plug it into a new computer, i get missing boot device. so i put my SLES install disk in cd drive and boot with that and choose repair system, it sees a bad MBR and i can tell it to fix it. then i can boot this new disk no problem and it works fine.

    so i'm reading online about saving and restoring the MBR. they say all i need to do from my working disk when i initially create that linuxsystem.tar file- if that disk were /dev/sdc on the system then i should do
    dd if=/dev/sdc of=/root/saved_mbr count=1.

    then after my "tar -xf /root/linuxsystem.tar" above I should do
    dd if=/root/saved_mbr of=/dev/sdb count=1.

    I've tried that, and it saved 512 bytes or blocks worth when doing the dd but it did not work. how do i get that to work ?
    when i remounted this cloned disk to my working system to start over, it also said partition table messed up was not gpt, so i had to redo that even.
     

Share This Page