LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 01-16-2004, 08:38 PM   #1
xianzai
Member
 
Registered: Oct 2003
Location: UK
Distribution: RHEL4
Posts: 54

Rep: Reputation: 15
Question Re-writing Linux to the MBR


Hi there,

I have a dual boot system, Linux RH9 and WinXP Home, I want to change to WinXP Pro, but if I install it, it will rewrite the MBR, and I'll only be able to access Linux through my boot disk...

How can I rewrite Grub to the MBR? Is it possible?

Thanks for your help!
 
Old 01-16-2004, 09:09 PM   #2
leonscape
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Debian SID / KDE 3.5
Posts: 2,313

Rep: Reputation: 47
Yep its possible. Boot with your boot disk. Get to a console and as root type:

grub
--wait a while as it probles the bios--
root(hdx,x) --Your /boot partition or / if you haven't got a boot partition--
setup(hd0)
quit

Now reboot and everthing should be back in order.
 
Old 01-17-2004, 05:39 AM   #3
xianzai
Member
 
Registered: Oct 2003
Location: UK
Distribution: RHEL4
Posts: 54

Original Poster
Rep: Reputation: 15
Great stuff! Thanks so much for your help!
 
Old 01-17-2004, 04:52 PM   #4
rile
Member
 
Registered: Oct 2003
Distribution: Slackware
Posts: 35

Rep: Reputation: 15
I'm about to install win2k and run dualboot. But how do i make a bootdisk in linux? Oh, and one more thing... I use lilo, how do i rewerite the MBR then? The same way as grub?
 
Old 01-17-2004, 05:11 PM   #5
leonscape
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Debian SID / KDE 3.5
Posts: 2,313

Rep: Reputation: 47
To make a boot floopy for your machine ( And it will ONLY work for your machine ) go into /etc/lilo.conf and comment out the line boot=/dev/hda and add the line boot=/dev/fd0 So it looks like this:

#boot=/dev/hda
boot=/dev/fd0

Now save it. Put a blank floppy in and as root type /sbin/lilo. This will create your boot floopy. Don't forget to change things back after its finished.

To restore LILO to the MBR simply execute /sbin/lilo again. Allthough you will need to alter the lilo.conf for you new OS.
 
Old 01-17-2004, 06:23 PM   #6
mysterio
Member
 
Registered: Sep 2003
Location: Springfield Ma.
Distribution: Mandrake 9.2,Knoppix 3.7,Slackware 10.0, FreeBSD. 5.3, OpenBSD 3.6, NetBSD 2.0, Debian
Posts: 275

Rep: Reputation: 30
Another way to make a boot floppy is at the command line type mkbootdisk kernel version and your good to go.Of course substitute kernel version for your own actual kernel version.
 
Old 01-17-2004, 06:46 PM   #7
leonscape
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Debian SID / KDE 3.5
Posts: 2,313

Rep: Reputation: 47
mkbootdisk can also be mkboot, but its implentation varies quite a bit. If it exists at all.
 
Old 01-17-2004, 07:00 PM   #8
rile
Member
 
Registered: Oct 2003
Distribution: Slackware
Posts: 35

Rep: Reputation: 15
I did what you said leonscape, with the bootdisk, but when i checked the floppy after i'd typed "/sbin/lilo", there was nothing on the disk. I'm just wondering if that's correct
 
Old 01-17-2004, 08:04 PM   #9
leonscape
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Debian SID / KDE 3.5
Posts: 2,313

Rep: Reputation: 47
Usually, Its simply written the first block of the disk as a bootloader. Try Booting with it. ( Which you should always do to make sure boot disks works, I've been burned by bad disks ).
 
Old 02-29-2004, 01:06 AM   #10
rssarma
LQ Newbie
 
Registered: Feb 2004
Posts: 2

Rep: Reputation: 0
Conversely,

In case I remove linux from my system, is it possible for me to remove LILO from the MBR? and if yes, then how?
 
Old 02-29-2004, 08:33 AM   #11
mysterio
Member
 
Registered: Sep 2003
Location: Springfield Ma.
Distribution: Mandrake 9.2,Knoppix 3.7,Slackware 10.0, FreeBSD. 5.3, OpenBSD 3.6, NetBSD 2.0, Debian
Posts: 275

Rep: Reputation: 30
You sure can, in windows type "fdisk /mbr" without the quotes, and you should be good to go.

Last edited by mysterio; 02-29-2004 at 08:35 AM.
 
Old 02-29-2004, 10:11 AM   #12
rssarma
LQ Newbie
 
Registered: Feb 2004
Posts: 2

Rep: Reputation: 0
Thanks very much, I used the FIXMBR from the recovery console, and it worked too !!
 
  


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
by tring to fix the MBR i damage the MBR that was help... AKAKAK Fedora 4 03-21-2005 08:18 AM
GRUB MBR overwritten by WIN98 MBR TOuseef Linux - General 7 11-14-2004 04:25 PM
writing mbr slackware_03 Linux - Newbie 1 08-12-2004 10:21 AM
Lilo - Writing to MBR - Curious Problem streamalot Linux - General 8 04-07-2002 09:43 PM
Writing to the MBR HHH Linux - Software 5 09-17-2001 05:55 PM


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