LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-19-2008, 07:09 PM   #1
msrpower
LQ Newbie
 
Registered: Mar 2006
Posts: 26

Rep: Reputation: 15
Reinstalling Grub


Hi, i`ve installed Ubuntu on my external USB Hard-disk ans it places the GRUB in the MBR of my laptop`s internal HD.

How can I reinstall GRUB on the MBR of the external HD ?

thanks in advance.
 
Old 12-19-2008, 07:21 PM   #2
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: PCLinux, Slackware
Posts: 6,872

Rep: Reputation: 1249Reputation: 1249Reputation: 1249Reputation: 1249Reputation: 1249Reputation: 1249Reputation: 1249Reputation: 1249Reputation: 1249
Need more info to give you accurate instructions. Incidentally, what happened (installing Grub to mbr of primary disk) is default behavior and if you don't want that you need to manually make changes. Assuming you can log into your system, run this command:

sudo fdisk -l (Lower case Letter L, not a one)

Post the output here.
Post the output of the file /boot/grub/menu.lst

Number and type of operating systems would be helpful also, particularly what you have on the internal drive and how you boot it. If you place Grub for Ubuntu only on the mbr of the external drive, you will need to change BIOS boot order whenever you want to boot it.
 
Old 12-20-2008, 07:06 AM   #3
msrpower
LQ Newbie
 
Registered: Mar 2006
Posts: 26

Original Poster
Rep: Reputation: 15
Hi yancek, thanks for the answer,

Quote:
Originally Posted by yancek
If you place Grub for Ubuntu only on the mbr of the external drive, you will need to change BIOS boot order whenever you want to boot it
yes, this is what i wanna do. I want to remove the GRUB of the primary boot disk and change the boot order whenever I want to boot it.

The command fdisk -l results :

Code:
Disk /dev/sda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xe9e6bd8e

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1       14594   117218304    7  HPFS/NTFS

Disk /dev/sdb: 250.0 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x5b6ac646

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1       14957   120142071   83  Linux
/dev/sdb2           14958       15200     1951897+  82  Linux swap / Solaris
/dev/sdb3           15201       30401   122102032+   7  HPFS/NTFS
I want to remove the GRUB from sda and place it in the sdb.

Last edited by msrpower; 12-20-2008 at 07:26 AM.
 
Old 12-20-2008, 08:11 AM   #4
Larry Webb
LQ Veteran
 
Registered: Jul 2006
Location: Crystal Beach, Texas
Distribution: Suse for mail +
Posts: 5,100
Blog Entries: 7

Rep: Reputation: 229Reputation: 229Reputation: 229
I presume you have sdb set to be first boot.
 
Old 12-20-2008, 08:37 AM   #5
CJS
Member
 
Registered: May 2008
Location: California, USA
Distribution: Ubuntu 8.10
Posts: 247

Rep: Reputation: 49
Msrpower, to install Grub to the MBR of your external drive and also set the boot flag on sdb1, how about doing:
Code:
sudo grub
grub> root (hd1,0)
grub> makeactive
grub> setup (hd1)
grub> quit
And then to restore a Windows equivalent MBR to your sda drive so you can boot directly into Windows if you boot the sda drive:
Code:
sudo lilo -M  /dev/sda mbr
Then reboot, set your BIOS to boot the external sdb drive, and you should at least get the Grub menu on start up. If you are using Intrepid, the Ubuntu entries in the Grub menu should work, but if you are using a previous Ubuntu version, most likely the Ubuntu entries will give you a Grub error and require a small fix. How about seeing if you can get this far, or let us know if you run into problems.
 
Old 12-20-2008, 08:55 AM   #6
msrpower
LQ Newbie
 
Registered: Mar 2006
Posts: 26

Original Poster
Rep: Reputation: 15
Thanks CJS, i`m not using Intrepid, i`m using 8.04.1.

I have followed your hints and could get the Grub menu, but as you said, i got this error message :

Error 17: Cannot load the selected partition.
 
Old 12-20-2008, 09:00 AM   #7
CJS
Member
 
Registered: May 2008
Location: California, USA
Distribution: Ubuntu 8.10
Posts: 247

Rep: Reputation: 49
Quote:
Originally Posted by msrpower View Post
Thanks CJS, i`m not using Intrepid, i`m using 8.04.1.

I have followed your hints and could get the Grub menu, but as you said, i got this error message :

Error 17: Cannot load the selected partition.
OK, go ahead and reboot again, and when you get the Grub menu on start up, select the first Ubuntu entry, press "e" to edit it, select the line that says "root (hd1,0)", press "e" to edit it, change it to "root (hd0,0)", press return to save the change, then press "b" to boot. As long as your Grub's current menu.lst isn't too far off (which I woudn't expect), that should be all it takes to boot Ubuntu. Note that the above change is not permanent, so you'll need to modify your menu.lst to make it permanent.

So if it works, when you get into Ubuntu, just do:
Code:
gksudo gedit /boot/grub/menu.lst
And change the line that says "#groot=(hd1,0)" to use (hd0,0):
Code:
# groot=(hd1,0)
Save, quit gedit, then run:
Code:
sudo update-grub
And you should be all set. Let me know how it goes or if you run into problems.
 
Old 12-20-2008, 09:19 AM   #8
msrpower
LQ Newbie
 
Registered: Mar 2006
Posts: 26

Original Poster
Rep: Reputation: 15
It works perfectly! thank you very much.
 
Old 12-20-2008, 09:22 AM   #9
CJS
Member
 
Registered: May 2008
Location: California, USA
Distribution: Ubuntu 8.10
Posts: 247

Rep: Reputation: 49
Glad that worked OK; cheers and have fun with your Ubuntu install.
 
  


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] Reinstalling GRUB without Reinstalling my Distro MBA Whore Linux - Newbie 8 03-15-2008 09:39 PM
Need help reinstalling grub randell6564 Ubuntu 19 08-25-2006 06:33 PM
reinstalling GRUB vineet7kumar Linux - Newbie 1 01-15-2006 01:02 PM
GRUB not reinstalling jboo Linux - Software 5 10-02-2005 11:55 AM
Reinstalling GRUB Petelow Linux - Newbie 1 05-24-2004 05:03 AM


All times are GMT -5. The time now is 12:40 PM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration