LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-08-2003, 01:31 AM   #1
Xing
Member
 
Registered: Aug 2003
Location: New Delhi, India
Distribution: RH 9, RH 8, RH 7.3,Slackware
Posts: 123

Rep: Reputation: 15
loading grub on MBR


i have a dual boot machine with XP and RH8.0
i had to format my c drive and hence the MBR also got formatted and so did the grub. how do i reinstall grub in MBR?i do not want to destgroy the data. so no reload for me!
 
Old 09-08-2003, 01:48 AM   #2
croakofonix
LQ Newbie
 
Registered: May 2003
Location: Melbourne, Victoria, Australia
Distribution: RH9.0, Fedora Core 1, Fedora Core 2
Posts: 19

Rep: Reputation: 0
Xing,

I faced the same problem a couple of weeks back. I found a solution online and am pasting from the same document.

Put the redhat boot disk you created on the installation on the floppy
drive, boot the system and run grub command



Remember that for grub (hd0,1) means hda (primary controller master), second partition.



Now we need to tell grub where are the grub files:

If you know where they are type something like:
root (hd0,1)

else if you have no idea, type:
find /boot/grub/stage1
and then the root command with the correct parameters

setup (hd0)
to install it on hd0 that is MBR of the first HD

type quit and reboot

Another solution is :

If you didn't create the boot disk, boot with the Red Hat Linux CD number 1 and choosse rescue mode typing:
linux rescue



Now you need to repair the ext3 filesystem because now it's bigger than before and the journal file must be created again



First, check the filesystem:



fsck.ext3 /dev/hda2



Now, create again the journaling ext3 file:



tune2fs -j /dev/hda2



Now mount the root filesystem on /mnt/sysimage and run grub



mount -t ext2 /dev/hda2 /mnt/sysimage
cd /mnt/sysimage
cd sbin
grub

Once started, GRUB will show the command-line interface . First, set the GRUB's root device1 to the boot directory, like this:
grub> root (hd0,1)
If you are not sure which partition actually holds these files, use the command find, like this:
grub> find /boot/grub/stage1
This will search for the file name /boot/grub/stage1 and show the devices which contain the file.

Note added by: John Neuhaus
If you are using a separate /boot partition , as the official documentation says:
"... if you have the partition /boot and you install GRUB images into the directory /boot/grub, GRUB recognizes that the images lies under the directory /grub but not /boot/grub"
Then if 'find /boot/grub/stage1' does not find the file, try 'find /grub/stage1'

Once you've set the root device correctly, run the command setup :
grub> setup (hd0)
This command will install GRUB on the MBR in the first drive.

-Akshar
 
Old 09-08-2003, 02:06 AM   #3
Xing
Member
 
Registered: Aug 2003
Location: New Delhi, India
Distribution: RH 9, RH 8, RH 7.3,Slackware
Posts: 123

Original Poster
Rep: Reputation: 15
thnx

thnx akshar,

i will defenitely try this at home today.
till then any more suggestions are most welcome.

Regards
Xing
 
Old 09-08-2003, 07:04 AM   #4
Umasankar
LQ Newbie
 
Registered: Jul 2003
Posts: 11

Rep: Reputation: 0
Boot into rescue mode and run grub-install /dev/hda to install Grub in the MBR.

Note: Documents say, using grub interactively is better than running grub-install. But grub-install always worked for me.
 
Old 09-09-2003, 01:18 AM   #5
Xing
Member
 
Registered: Aug 2003
Location: New Delhi, India
Distribution: RH 9, RH 8, RH 7.3,Slackware
Posts: 123

Original Poster
Rep: Reputation: 15
akshar , your method worked.

umashanker, i had given forst shot to your method (because it was short and hence easy ) but it di not work. i got the message..

grub: could not find file or directory.

Thnx anyway.

and akshar, if possible send me the address of this document which u had pasted as solution to my problem.. i m assembling all the useful links on my website for use of other people.. so kindle oblige.
(once more )

regards
Xing
 
Old 09-09-2003, 12:33 PM   #6
croakofonix
LQ Newbie
 
Registered: May 2003
Location: Melbourne, Victoria, Australia
Distribution: RH9.0, Fedora Core 1, Fedora Core 2
Posts: 19

Rep: Reputation: 0
Xing,

'Twas a long time back (in computer years) that I looked it up online. I think your option would be to google and find the page....check out "Restoring Grub" on Google, thats how I got to the site.
Glad to know that I could be of help....

-Akshar
 
Old 09-09-2003, 01:57 PM   #7
patientzero
Member
 
Registered: Aug 2003
Location: Toronto
Distribution: Gentoo 1.4
Posts: 95

Rep: Reputation: 15
Ok, but was your XP partition NTFS or FAT32? I understand there are problems with grub and NTFS doing a multiboot?
 
Old 09-10-2003, 01:38 AM   #8
Xing
Member
 
Registered: Aug 2003
Location: New Delhi, India
Distribution: RH 9, RH 8, RH 7.3,Slackware
Posts: 123

Original Poster
Rep: Reputation: 15
patientzero

my XP partition was FAT32.. so no troubles... i try to keep my drives in FAT32 only because NTFS poses problems even with win OS'.

regards
vishesh
 
  


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
grub to mbr rekaye1005 Linux - General 1 10-18-2005 08:20 PM
Grub on MBR vivekian SUSE / openSUSE 13 02-20-2005 10:49 PM
GRUB MBR overwritten by WIN98 MBR TOuseef Linux - General 7 11-14-2004 05:25 PM
lilo / grub in MBR? neilcpp Slackware 4 03-28-2004 11:26 AM
Grub and MBR, need some help entm Linux - General 3 05-13-2002 04:49 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

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

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