LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > General
User Name
Password
General This forum is for non-technical general discussion which can include both Linux and non-Linux topics. Have fun!

Notices

Reply
 
Search this Thread
Old 03-27-2014, 05:03 PM   #1
ron7000
Member
 
Registered: Nov 2007
Location: CT
Posts: 58
Blog Entries: 1

Rep: Reputation: 17
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, 05:15 PM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,285

Rep: Reputation: 1029Reputation: 1029Reputation: 1029Reputation: 1029Reputation: 1029Reputation: 1029Reputation: 1029Reputation: 1029
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, 05:24 PM   #3
ron7000
Member
 
Registered: Nov 2007
Location: CT
Posts: 58
Blog Entries: 1

Original Poster
Rep: Reputation: 17
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 05:27 PM.
 
Old 03-27-2014, 09:21 PM   #4
enorbet
Member
 
Registered: Jun 2003
Location: Virginia
Distribution: Slackware 14 is Main OpSys on Main PC, 2ndary are OpenSuSe 13 and SolydK
Posts: 693

Rep: Reputation: 296Reputation: 296Reputation: 296
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, 10:23 PM   #5
sundialsvcs
Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 5,378

Rep: Reputation: 1108Reputation: 1108Reputation: 1108Reputation: 1108Reputation: 1108Reputation: 1108Reputation: 1108Reputation: 1108Reputation: 1108
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, 11:47 AM   #6
ron7000
Member
 
Registered: Nov 2007
Location: CT
Posts: 58
Blog Entries: 1

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

thanks.
 
  


Reply


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 02:28 PM
HELP! MBR defunct, cannot boot anymore D: GRUB loader crashed HoBu Linux - Laptop and Netbook 10 09-12-2009 12:36 PM
Restoring GRUB boot loader googlix Linux - General 2 01-15-2008 05:18 PM
Fedora Remove and restoring windows MBR boot loader eng_muhammad Fedora 3 12-03-2005 12:39 PM
Restoring boot loader (with boot disk?) Kylotan Linux - General 0 07-08-2004 06:29 AM


All times are GMT -5. The time now is 09:17 AM.

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