Did you know LQ has a Linux Hardware Compatibility List?
Go Back > Forums > Non-*NIX Forums > General
User Name
General This forum is for non-technical general discussion which can include both Linux and non-Linux topics. Have fun!


  Search this Thread
Old 03-27-2014, 06:03 PM   #1
Registered: Nov 2007
Location: CT
Posts: 248

Rep: Reputation: 26
help restoring MBR on cloned disk having Grub boot loader

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.
I'd like to do this a quicker way then having to boot from the SLES install cd which is time consuming.
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.
Old 03-27-2014, 06:15 PM   #2
LQ Veteran
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 13,819

Rep: Reputation: 1452Reputation: 1452Reputation: 1452Reputation: 1452Reputation: 1452Reputation: 1452Reputation: 1452Reputation: 1452Reputation: 1452Reputation: 1452
Cloning the MBR was always a bad idea - these days with gpt disk possibly in the mix, it's even more so.
Your cloning of filesystem up to that point is good - and safe. Keep it that way by repairing the bootloader properly, as you did from the boot CD.

Much better option IMHO.
Old 03-27-2014, 06:24 PM   #3
Registered: Nov 2007
Location: CT
Posts: 248

Original Poster
Rep: Reputation: 26
not what i wanted to hear

what does the install cd actually do during the MBR repair?
I'd like to be able to do that manually when i clone the disk to save time.

Last edited by ron7000; 03-27-2014 at 06:27 PM.
Old 03-27-2014, 10:21 PM   #4
Registered: Jun 2003
Location: Virginia
Distribution: Slackware 14 is Main OpSys on Main PC, 2ndary are OpenSuSe 13 and SolydK
Posts: 997

Rep: Reputation: 599Reputation: 599Reputation: 599Reputation: 599Reputation: 599Reputation: 599
It is my understanding that MBR and GPT are "oil and water". You need to use tools especially for UEFI implementation of GPT afaik. Also basic Grub cannot be used. You must use Grub2-efi or eLilo.
Old 03-27-2014, 11:23 PM   #5
LQ Guru
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 6,101

Rep: Reputation: 1509Reputation: 1509Reputation: 1509Reputation: 1509Reputation: 1509Reputation: 1509Reputation: 1509Reputation: 1509Reputation: 1509Reputation: 1509Reputation: 1509
I, too, would not attempt to "clone" the MBR. Instead, you should be able to format and then partition the disk, load each of the partitions with data, and then do a grub-install to write the necessary boot information into all the right places. The MBR, partition table and so-forth are very architectural things. I would not advise trying to "copy and restore" them.
Old 03-28-2014, 12:47 PM   #6
Registered: Nov 2007
Location: CT
Posts: 248

Original Poster
Rep: Reputation: 26
ok, i'll stick with booting from cd and performing the repair.



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] grub-setup is failing to write the primary boot loader to the MBR edbarx Debian 7 06-17-2013 03:28 PM
HELP! MBR defunct, cannot boot anymore D: GRUB loader crashed HoBu Linux - Laptop and Netbook 10 09-12-2009 01:36 PM
Restoring GRUB boot loader googlix Linux - General 2 01-15-2008 06:18 PM
Fedora Remove and restoring windows MBR boot loader eng_muhammad Fedora 3 12-03-2005 01:39 PM
Restoring boot loader (with boot disk?) Kylotan Linux - General 0 07-08-2004 07:29 AM

All times are GMT -5. The time now is 04:02 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration