LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Re-writing Linux to the MBR (https://www.linuxquestions.org/questions/linux-software-2/re-writing-linux-to-the-mbr-135600/)

xianzai 01-16-2004 08:38 PM

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! :)

leonscape 01-16-2004 09:09 PM

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.

xianzai 01-17-2004 05:39 AM

Great stuff! Thanks so much for your help! :)

rile 01-17-2004 04:52 PM

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?

leonscape 01-17-2004 05:11 PM

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.

mysterio 01-17-2004 06:23 PM

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.

leonscape 01-17-2004 06:46 PM

mkbootdisk can also be mkboot, but its implentation varies quite a bit. If it exists at all.

rile 01-17-2004 07:00 PM

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 ;)

leonscape 01-17-2004 08:04 PM

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 ).

rssarma 02-29-2004 01:06 AM

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?

mysterio 02-29-2004 08:33 AM

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

rssarma 02-29-2004 10:11 AM

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


All times are GMT -5. The time now is 06:12 AM.