LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   understanding grub loader (https://www.linuxquestions.org/questions/linux-newbie-8/understanding-grub-loader-270763/)

mrodent2 12-27-2004 09:04 AM

understanding grub loader
 
hi,

I am experimenting with linux and dual booting on a computer which is not my main one... I decided to delete (i.e. reformat brutally, from within WXP) all the partitions containing linux ... just to see what would happen!

and of course it now turns out that I can't boot either linux or WXP... I just get taken to the grub loader and haven't got a clue what to do, or how to repair the situation. Indeed, I tried to get the WXP installation disks to repair the situation... surprise...! the grub loader still loads!!

none of this is tragic, as I say I am experimenting with a secondary machine... somehow my linux installation seemed to have taken up a bit too much HD space anyway so it had to be sorted out... how does it know which partitions it is allowed to use anyway...??? another mystery

but I'd also like to know how to change the boot order of the grub loader, assuming I eventually get back to a dual boot situation, so that by default it loads WXP... I couldn't work out how to do this... and yet you would have hoped the designers of linux might've anticipated that newbies would want to do this... hmmmm....

in short, in order to avoid quite a lot of future tears and rage and premature heart conditions I think I need to know a bit more about how the grub loader thingy works... any pointers?

thanks,
mike

bigrigdriver 12-27-2004 09:22 AM

Grub installs a small part of itself to the MBR (master boot record) at the beginning of the harddrive. If only xp were installed, it would do the same with it's bootloader.

Since you can'b boot from the xp install cd, I'd guess that your BIOS isn't set to poll the cd drive before the harddrive. You need to restart the computer and edit the bios to poll the cd before booting from HDD. If I remember correctly, you press the delete key while the computer is running the POST routines. There should be a message at the bottom of the screen telling you which key to press.

Once you get the Bios configured, use the xp install disk to boot, and boot into the xp version of command line mode. Then run 'fdisk /mbr', or maybe it's 'fdisk \mbr' to restore the mbr for xp to be bootable. Then re-install Linux.

Grub boots Linux and some other Unix compatibles natively. For xp, grub used the chainloader command to pass booting from grub to xp's bootloader.

Partitions are formatted for the OS that will be installed there. There are octal (?) codes which designate OS type. I don't remember what it for xp, but Linux swap is something like 0x82 and Linux is 0x83 (or something along those lines). That's how the detection and identification is done.

To change the boot order in grub, there are two ways to do it. In the /boot/grub directory, you will have either a grub.conf or menu.lst file. That's the one used by grub to setup the menu you see when grub starts up.

There is a line: default 0. That tells grub to boot the first OS in the list ad the default (grub numbers start at 0). So, if xp is second in the list, change to default 1, and xp is now the default.
Or, just cut and paste the parts of the list to put the OS you want as default as first in the list, and leave the default 0 as is.

Then, google up a copy of the Grub Manual, and read.

mrodent2 12-27-2004 09:28 AM

nice one, thanks very much!

aus9 02-24-2005 12:30 AM

I have written stuff U won't find in any manual like the cdr and multifloppy way and other juicy stuff in my tutorial


All times are GMT -5. The time now is 07:14 PM.