LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 06-27-2008, 05:32 PM   #1
Excalibre
LQ Newbie
 
Registered: Jun 2008
Posts: 18

Rep: Reputation: 0
How to reinstall GRUB after moving partitions around?


I'm using Ubuntu 8.04 but I'd like to try some other distributions; unfortunately, this is going to mean some screwing around with my partitions. Basically I'm going to have to move my root partition (with /boot, since it's not on its own partition) elsewhere. I understand in a basic way how to do this -- basically, create a new partition and copy the contents of the old one to it, and then I'm going to have to edit /boot/grub/menu.lst so that everything knows where it is. But I can't figure out how to actually reinstall GRUB.

I'm going to be doing the actual partitioning from a live CD but I don't know how to then reinstall GRUB and tell stage 1 where to find stage 2 (I think I have a handle on what those things are.) I'm going to have to reinstall GRUB on the MBR, correct? But how do I tell it where to look for stage 2? My understanding is that there's only one command line parameter to pass grub-install, which is where to put stage 1.
 
Old 06-27-2008, 05:49 PM   #2
jailbait
Guru
 
Registered: Feb 2003
Location: Blue Ridge Mountain
Distribution: Debian Wheezy, Debian Jessie
Posts: 7,575

Rep: Reputation: 185Reputation: 185
Quote:
Originally Posted by Excalibre View Post
I'm going to have to reinstall GRUB on the MBR, correct? But how do I tell it where to look for stage 2? My understanding is that there's only one command line parameter to pass grub-install, which is where to put stage 1.
You need to install grub while running in the / partition where the grub stage2 is located. The way to do that is to:

boot from a live CD

mount the correct / partition

chroot to the correct / partition

If /boot is a separate partition then mount /boot

run grub-install

reboot

---------------------
Steve Stites
 
Old 06-27-2008, 06:02 PM   #3
alan_ri
Senior Member
 
Registered: Dec 2007
Location: Croatia
Distribution: Debian GNU/Linux
Posts: 1,733
Blog Entries: 5

Rep: Reputation: 127Reputation: 127
Code:
sudo grub
Code:
grub> find /boot/grub/stage1
if you get for example (hd0,1),then
Code:
grub> root (hd0,1)
will install grub from that partition and
Code:
grub> setup (hd0)
will install it on the MBR.(hd0,1) will install it on that partition and (hd1,x)on the second HD and so on.
 
Old 06-27-2008, 06:05 PM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,431

Rep: Reputation: 1066Reputation: 1066Reputation: 1066Reputation: 1066Reputation: 1066Reputation: 1066Reputation: 1066Reputation: 1066
I don't even bother with the chroot - I usually just run the grub command, either from the installed system, or from the liveCD itself. grub-install being merely a wrapper for the grub (sub-)commands.
Not something to stress over - easy to fix even if it goes wrong.
 
Old 06-27-2008, 06:26 PM   #5
Duck2006
Member
 
Registered: Sep 2006
Distribution: Ubuntu 8.04 Hardy Heron LST
Posts: 346

Rep: Reputation: 33
http://users.bigpond.net.au/hermanzone/p15.htm
 
Old 06-27-2008, 09:04 PM   #6
Excalibre
LQ Newbie
 
Registered: Jun 2008
Posts: 18

Original Poster
Rep: Reputation: 0
Great! Thanks all of you, this won't be a problem at all!
 
  


Reply

Tags
grub, grub config, partition


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
Grub error 17, and wont reinstall using grub-install! chiefreborn Linux - General 6 06-06-2007 11:29 AM
How do I get rid of Linux partitions and reinstall? agentchange Suse/Novell 3 06-07-2006 04:24 AM
reinstall windows, reinstall GRUB too? leupi Linux - Software 1 05-07-2005 11:50 AM
Moving Settings for Reinstall. Riddick Suse/Novell 6 11-03-2004 09:56 AM
Gentoo - Resizing the Partitions without reinstall backflippin Linux - Software 2 04-07-2004 01:04 AM


All times are GMT -5. The time now is 11:42 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