How to switch from LILO to GRUB 

http://www.linuxquestions.org/questions/showthread.php?t=224547&page=3

The first thing is to get rid of LILO:

#apt-get -y remove --purge lilo
#apt-get clean

Then, to install grub:

#apt-get update
#apt-get install grub
#grub-install /dev/hdx

where 'x' is the letter of the hd in question. For example, if you only got one hd, then it's 'hda', if you got a slave one, then it will probably be 'hdd' or whatever, make sure you know what your second one is, if you're going to install grub on it.

#update-grub

This last step is crucial!!!

reboot, to check it out.

macondo 10-13-2004

Install grub 

% fdisk -l
Disk /dev/hda: 255 heads, 63 sectors, 5005 cylinders
Units = cylinders of 16065 * 512 bytes
   Device Boot    Start       End    Blocks   Id  System
/dev/hda1           387      3096  21768043+   c  Win95 FAT32 (LBA)
/dev/hda2   *         1       386   3100513+  83  Linux
/dev/hda3          3097      5005  15334042+   f  Win95 Ext'd (LBA)
/dev/hda5          3097      3160    514048+  82  Linux swap
/dev/hda6          3161      4180   8193118+  83  Linux
%  grub-install /dev/hda2
Installation finished. No error reported.
This is the contents of the device map /boot/grub/device.map.
Check if this is correct or not. If any of the lines is incorrect,
fix it and re-run the script `grub-install'.
# this device map was generated by anaconda
(fd0)     /dev/fd0
(hd0)     /dev/hda
% cat /boot/grub/grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You do not have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /, eg.
#          root (hd0,1)
#          kernel /boot/vmlinuz-version ro root=/dev/hda2
#          initrd /boot/initrd-version.img
#boot=/dev/hda2
default=0
timeout=10
splashimage=(hd0,1)/boot/grub/splash.xpm.gz
title Red Hat Linux (2.4.18-14)
        root (hd0,1)
        kernel /boot/vmlinuz-2.4.18-14 ro root=LABEL=/ hdc=ide-scsi
        initrd /boot/initrd-2.4.18-14.img
title DOS
        rootnoverify (hd0,0)
        chainloader +1

configuration file 

# By default, boot the first entry.
default 0
# Boot automatically after 30 secs.
timeout 30

What are the two roots in grub? 

Newsgroups: gmane.linux.debian.user
Date: Mon, 19 Feb 2007 12:46:48 -0500

Do I understand this correctly?

In my /boot/grub/menu.lst there is a stanza

title          other: Debian GNU/Linux, kernel 2.6.18-3-486
root           (hd0,7)
kernel         /vmlinuz-2.6.18-3-486 root=/dev/mapper/lovesong-other ro
initrd         /initrd.img-2.6.18-3-486
savedefault

(I edited the title fro what the installer gave me)

Does this mean that grub will look in (hd0, 7), which is the same as /dev/hda8, which is the fourth partition in the extended partition, to find the file /vmlinuz-2.6.18-3-486, and then use that file as a kernel to boot Linux, mounting /dev/mapper/lovesong-other on / ?

yes.

> title                other: Debian GNU/Linux, kernel 2.6.18-3-486
> root         (hd0,7)
 ^^^^

This particular "root" is the "grub installation root" IOW it will load the following line like this

(hd0,7)/vmlinuz-2.6.18-3-486 root=/dev/mapper/lovesong-other ro
> kernel       /vmlinuz-2.6.18-3-486 root=/dev/mapper/lovesong-other ro
                                     ^^^^

That root is the "root" of your machine. and it is passed onto your kernel as a command line option.

Greg Folkert

What are the two roots in grub? 

Newsgroups: gmane.linux.debian.user
Date: Fri, 3 Jun 2005
title  Debian 2.6.8
root (hd0,1)  # = /boot -> /dev/hda2
kernel /vmlinuz-2.6.8-1-386  root=/dev/hda5  # '/' device

mess-mate @free.fr

mkboot with grub 

Newsgroups: gmane.linux.debian.user
Date: Fri, 3 Jun 2005
> I'm using Grub. Is there a method of making a bootdisk with grub bootloader?

No problem with lilo, but if you like grub:

  1. format a floppy

  2. cd /floppy

  3. mkdir /doc

  4. mkdir /grub

  5. mkdir /pict

  6. then,

    cp ......stage1 /floppy/grub/
    cp ......stage2 /floppy/grub/

create and edit a file menu.lst as follows:

splashimage (fd0)/boot/grub/images/linuxinside.xpm.gz

# Boot automatically after 30 secs.
timeout 30

# By default, boot the first entry.
default 0

# Fallback to the second entry.
fallback 1

# For booting Debian Linux
title  Debian 2.6.8
root (hd0,1)  # = /boot -> /dev/hda2
kernel /vmlinuz-2.6.8-1-386  root=/dev/hda5  # '/' device
initrd /initrd.img-2.6.8-1-386

title  Debian 2.6.10
root (hd0,1)
kernel /vmlinuz-2.6.10-1-686  root=/dev/hda5
initrd=/initrd.img-2.6.10-1-686

(adjust vmlinuz and initrd… and where your /boot/vmlinuz… is, here first hd second oartition)

Save this file to /floppy/grub/

Adapt also your splashimage if necessary.

mess-mate @free.fr

How to restore GRUB menu after Windows installation? 

  1. Read General Notes

  2. e.g. Assumed that /dev/hda1 is the location of /boot partition

  3. Read How to use Ubuntu Installation CD, to gain root user access?

  4. do

    sh-2.05b# grub
    grub> root (hd0,0)
    grub> setup (hd0)
    grub> quit

Grub location 

http://wolvix.org/node/652

  1. . . this command line is exactly what the wcp installer does, i.e.

    grub-install --root-directory=/mnt/hdxy /dev/hdz

where xy is partition y on hard disk x (in your case, partition 3 on the first hard disk) and z is the first hard disk device.

GRUB is installed on the mbr, and the grub files, including menu.lst, placed in /boot/grub on the partition where you install wolvix (hdxy).

documented on: 2007-07-26, oithona

Grub location 

Sorry I wasn't very clear. Now to clear the rest of the confusions…

oithona is absolutely right about what grub does, but it might not be clear to ordinary people what exactly those actions mean.

Now in layman's term, the

grub-install --root-directory=/mnt/hdxy /dev/hdz

will alter the MBR of hard disk z so at to make it bootable, and all grub booting info (the grub files, including menu.lst etc) is stored locally on hdxy, and grub boots using those files, from hdz MBR.

> The confusion is also caused by programme such a smart boot manager which
> sometime continue to show a partition which previouly have the boot files
> & menu.1st on it, as bootable, even when grub had been reinstalled
> elsewhere.

Can smart boot manager actually boot such partitions (that previouly have the boot files & menu.1st), even when grub had been reinstalled elsewhere?

> practically all the linux distros will chain load win xp correctly

You may want to try if omitting 'makeactive' when chain loading win xp is OK, 'cause I just found that I can boot Win2K without make its partition active first!

documented on: 2007-07-29, xpt

Best place for Grub 

> > Can smart boot manager actually boot such partitions (that previouly have
> > the boot files & menu.1st), even when grub had been reinstalled elsewhere?
>
> No , trying to boot it will get a "no a bootable partition error".

That's what I thought.

This just add another point why it is not a good idea putting grub in MBR.

FYI, had the grub been put into the partition:

grub-install --root-directory=/mnt/hdxy /dev/hdxy

ie, let grub alter the partition of hard disk x partition y so at to make it bootable, even you've also install grub somewhere else, you can still and always boot partition hdxy, provided that you don't move its /boot.

Now I install grub into the 3rd primary partition, which is linux, then make it active. From there I can boot what ever partitions on the HD, or even alian USB ones, if I need to (by manually edit grub boot menu before boot). I never need Smart Boot Manager before and hopefully never will.

With Win2k not insisting its partition to be active to be bootable, this is the perfect boot solution to me — the grub will chain load win Win2k/xp correctly.

To recap from http://xpt.sourceforge.net/techdocs/nix/disk/boot/boot03-LinuxSpecificBooting/index.html#_Look_before_you_leap_pick_your_installer_carefully

MBR is a hot spot everyone is recklessly trying to lay their hands on, especially Windoze, and its ever increasing viruses. I never bothered to create "secure disk" for the tons of Linux OS I've been working on, because installing the boot loader into my Linux partition is my "secure" solution.

documented on: 2007-07-29, xpt

Managing grub/menu.lst with multiple distros 

Newsgroups: gmane.linux.debian.user
Date: Sun, 16 Sep 2007
> Is there a way that each of them can update grub (initrd, vmlinuz,
> menu.lst etc.) automatically upon a kernel upgrade?

Simple, run

update-grub

after a fresh install or after you upgrade your kernel. Ref:

http://xpt.sourceforge.net/techdocs/nix/disk/boot/boot06-Grub/index.html#How_to_switch_from_LILO_to_GRUB

> . . . why can the installer only detect a Windows installation and not
> other Linux distros? . . .

Yeah, I am wondering why update-grub can't do that myself.

> I have been trying to find out how to get grub updated for both
> Debian(Sid) and the recently installed Gutsy(pre-release).

Why not just chain load them? Whatever OS, even window$, grub's chain load can boot them fine, as long as the partition is bootable by itself. Ref:

http://xpt.sourceforge.net/techdocs/nix/disk/boot/boot06-Grub/ar01s06.html#Editing_the_GRUB_Menu

If the partition is not bootable by itself, especially when you install the grub to MBR, you can still put an entry in you main menu.lst, eg,

configfile (hd1,0)/grub/menu.list

so as to refer to its boot menu from the main boot partition.

HTH

xpt

Getting to know GRUB 

http://www-105.ibm.com/developerworks/education.nsf/linux-onlinecourse-bytitle/0F1731DC664023B7862569D0005C44AF?OpenDocument

Daniel Robbins

Need registration for this tutorial

A GRUB Tutorial 

Hoyt Duff

What makes GRUB a good alternative to LILO? 

The LInux LOader has been the standard bootloader for Linux. It is well-documented and widely used, so why even bother with another bootloader?

The GRUB bootloader is interactive and supports a BASH-like command line which features autocomplete making the use of a "universal" boot floppy possible. GRUB understand filesystems and can search them for files, helping you find file names and boot unfamiliar systems. GRUB reads its configuration from a text file at each boot, so it doesn't have to be re-run with each configuration change. How often have you forgotten to do that with LILO? GRUB is network-aware and can be compiled to run with network support like bootp, rarp, DHCP and tftp. GRUB can hide and unhide partitions, allowing multi-booting of normally conflicting operating systems. Unlike most bootloaders that know the kernel location only from a map, GRUB can load a kernel from anywhere it can 'see' on the disk without knowing where the kernel is beforehand

device names 

GRUB device names are not like the Linux device names with which you are familiar. This is the biggest hurdle in understanding GRUB, so we'll address this first.

All the device names are enclosed in parentheses.

There are two device names: (fd) for floppy drives and (hd) for hard drives (yes, both IDE and SCSI).

Drives are numbered beginning with 0. The developers of GRUB claim a desire to "fix" this in future releases so that the first device is numbered 1 instead of 0, but we won't be holding our breath. Hard drives are numbered sequentially in the order that the are detected by the BIOS. Changing the BIOS boot order will change the GRUB device name, so be careful.

Partitions within a drive are numbered sequentially beginning with 0. BSD slices are handled in a slightly different manner and you should consult the GRUB docs for BSD specifics. Partition numbers of extended partitions are always counted from 4.

Our Example System 

Let's look at an example system that has a single floppy drive, an IDE drive connected as the primary master (three partitions - VFAT, EXT2 and Linux swap), an IDE drive at the secondary master (two partitions - vfat and ext2), as well as a SCSI drive that is not configured to be bootable (with a BSD installation).

Here's a table of how each partition would be named in LILO and in GRUB

LILO           GRUB
/dev/fd0       (fd0)
/dev/hda1      (hd0,0)
/dev/hda2      (hd0,1)
/dev/hda3      (hd0,2)
/dev/hdc1      (hd1,0)
/dev/hdc2      (hd1,1)
/dev/scd0      (hd2,0)

Editing the GRUB Menu 

Let's edit Entry 6 first. On our example system, Windows98 is installed on the first partition of the first disk. Mounting the floppy and using our favorite text editor, we now have the following:

A Windows Menu 
Example: Entry 6: Sample chainloaded OS.
title Windows 98ME

root (hd0,0)

makeactive

# Chainload from the first sector
chainloader +1

# If you want DOS, but Windows NT is installed, then use:
# chainloader /bootsect.dos

and then we save the file. It's not necessary to follow up by running GRUB as you do with LILO. How many times have you changed /etc/lilo.conf and forgotten to do just that? We have lost count.

A Linux Menu 

Now, we'll edit the GNU/Linux entry to accommodate our Mandrake install on a reiserfs partition.

Example: Entry 5: Sample GNU/Linux boot. title GNU/Linux (hd0s2)
root (hd0,1)

kernel /boot/vmlinuz-2.4.3-20mdk root=/dev/hda2 read-only

# Don't forget that some distributions rely on an initial ramdisk:
initrd /boot/ initrd-2.4.3-20mdk.img

Note that we changed the kernel name to match the one we will be using, uncommented the initrd entry (that's necessary for us to use the reiserfs) and named the initrd file appropriately.

We have another Linux distro installed on our second drive on the ext2 partition, so we'll add another entry to our menu. Note that the entries are sequentially numbered, but this is just for our own housekeeping use. If we want to use the default command in our menu to specify a default entry, we need to remember that the entries are numbered by GRUB beginning with zero.

Since no special drivers are being loaded, there is no initrd. Our new entry looks like:

Example: Entry 7: GNU/Linux boot.
title RedHat 7.1
root (hd1,1)
kernel /boot/vmlinuz root=/dev/hdc2 read-only

# Note that we used the Linux name for the root partition.

# Don't forget that some distributions rely on an initial ramdisk:
#initrd /boot/initrd
A DOS Menu 

Gluttons for punishment that we are, we also have DOS 6.22 installed on the first partition of our second IDE disk. We need to hide the Windows partition, unhide the DOS partition and make the DOS partition active to keep the DOS bootloader happy. Since we do that for DOS, we also must do it for Windows, so don't forget to edit that menu entry as well.

Windows and DOS are somewhat egomaniacal and need to believe that they are the only Microsoft OS on the drive. We can fool them by using the hide/unhide commands. They also want to believe that they are on the first disk. In our example, DOS is on the second disk so we need to re-map the drives to fool the OS.

Example: Entry 8: chainloaded OS. title DOS 6.22
 # Let's fool DOS into thinking it's alone in the world by hiding Windows.
 hide (hd0,0)
 unhide (hd1,0)

 # Now we make DOS think it's on the first drive so it's happy.
 map (hd0) (hd1)
 map (hd1) (hd0)

 # Now we can begin to mount the root partition and
 # load the chainloader that loads the Windows OS.

 # Our root is the first partition of the first drive (since we switched them).
 root (hd1,0)

 # Here, we could use the rootnoverify which will set the root partition, but not
 # mount it. This is especially useful if the kernel is somewhere on the disk
 # that GRUB can't see, but it can see the chainloader.
 # DOS and Windows seem to work well both ways.

 # And we make it the active partition.
 makeactive

 # The "+1" tells GRUB to boot the chainloader from the first sector,
 # rather than attempt to load Windows by GRUB itself.
 chainloader +1

We now need to go back and edit our Windows entry to reverse the hide/unhide process we now use for DOS so Windows will boot correctly, a trick LILO can't accomplish. We don't need to use map again because that is only in effect for the current session and is reset upon reboot.

A FreeBSD Menu 

Finally, we have FreeBSD installed on our SCSI drive, so the menu item for that will look like:

Example: Entry 9: BSD
 title FreeBSD 4.3

 # Remember, we are using the SCSI drive and BSD does "slices", so the root
 # partition will be "a".
 root (hd2,a) 2

 # We don't call the kernel, but do call the BSD bootloader.
 kernel /boot/loader

Note the number "2" after the root command. This is the HDBIAS and tells a BSD kernel how many BIOS drive numbers are on controllers before it. In our example, there are two.

Do I Really Need a GRUB Menu? 

You don't need a GRUB menu, but if you want one, it is a simple text file created with any editor (even a Windows/DOS editor if you insist). It's named menu.lst (as in "el"-s-t, not 'one'-s-t — some fonts make this impossible to distinguish) and is kept in /boot/grub. Use the example shown here or in the GRUB docs to create one. If it fails to work, your computer won't crash and your data won't be lost, you'll just have to boot manually and try again.

Installing GRUB on Your Hard Drive 

We have assumed that you are experimenting with GRUB from a boot floppy, but GRUB can happily live in your MBR just as LILO did. Installing is incredibly easy:

# grub-install

does the trick.

If you don't like GRUB and want to return to LILO,

# lilo

If you don't like GRUB and want to return to the Windows bootloader (we can't imagine why, but it's your computer), boot from the Emergency Boot Floppy and run:

a:\fdisk /mbr

grub-install 

grub-install INSTALL_DEVICE

The device name INSTALL_DEVICE is an OS device name or a GRUB device name, e.g, '(hd0)' or /dev/fd0

Passwords 

For the paranoid among us ( and who shouldn't be a little paranoid about computer security), GRUB offers password protection of individual menu items.

To use passwords, first add a line at the beginning of the menu.lst file:

password <mypassword>

where <mypassword> is your password.

For each boot option you wish to password protect, add the command lock to the beginning of that section. Obviously, you want to have lock in the section that boots to the partition that hold menu.lst. However, don't consider password protection to be any kind of real security since anyone could easily bypass this by using their own GRUB boot floppy.

GRUB Docs and the Info Command 

We need to congratulate the developers of GRUB on one thing that sets them apart from many other Open Source projects — the availability of excellent documentation. You access it using info (as in info grub at a shell prompt) instead of using the man page system. The documentation contains detailed explanations of the workings of GRUB including a surfeit of excellent examples as well as a tutorial.

What is initrd? 

If you're curious as to what is in the initrd (initial ramdisk) file, it's a gzipped filesystem image! Copy it to another location and rename it with a .gz extension. Then, gunzip it and it loses the .gz extension. Mount this file (on /mnt/image in our example) with

# mount -o loop initrd /mnt/image

and you can browse it like any filesystem. For more details, read The Loopback Root Filesystem HOWTO at http://www.linuxdoc.org/HOWTO/mini/Loopback-Root-FS.html#toc2r .

GRUB at the GRUB Shell Prompt 

Create a boot floppy from the boot floppy image as described previously and boot your computer from it.

Because the boot floppy has a /boot/grub/menu.lst on it, you will see the supplied boot menu which will not likely be set to any useful defaults for you.

Here we see the menu options. If you highlight the one for GNU/Linux and press Enter, you'll see:

The "e" command allow us to edit each line individually and the "o" command adds a line for us to include our initrd.

Finally, we use the "b" command to boot into our Mandrake 8.0 installation.

Hardcore GRUB — No Menu 

Let's try doing the same thing using the GRUB command line, using the "c" command to get there. After seeing a message, we are greeted by the GRUB prompt:

grub>

We set the root partition first, but let's see what command completion will do for us, so type:

grub> root (

and then press the TAB key. We are told:

grub> root ( Possible disks are: fd0 hd0 hd1 hd2

Remember that these are our floppy drive, the primary master IDE drive, the secondary master IDE drive and the SCSI drive, detected by GRUB in their BIOS boot order.

We now type some more:

grub> root (hd0,

and press TAB to see a list of all partitions on the drive.

grub> root (hd0,

Possible Partitions are: Partition num: 0, Filesystem type is fat, partition type 0xc Partition num: 1, Filesystem type is ext2, partition type 0x83 Partition num: 2, Filesystem type is unknown, partition type 0x82

We will complete the entry for partition 1, our GNU/Linux installation and press Enter.

Second, we want to tell GRUB what kernel to boot, but we're not certain of the full name, so we use the find command (since we have mounted the partition using the root command). We'll use the autocomplete function to help us, so type:

grub > kernel /

and press the TAB. It will display the possible completions like the Bash shell. Continue until the full path and name of the kernel are displayed. If you want to add kernel arguments, they follow at the end of this line. Then press Enter.

grub> kernel /boot/vmlinuz-2.4.3-20mdk root=/dev/hda2

Third, we need to load the initrd image so the Linux kernel has the reiserfs module available to it. We do so with the initrd command and use the autocomplete function as before.

grub> initrd /boot/initrd-2.4.3-20mdk.img

And finally, since we are working at the GRUB shell prompt, we give the boot command.

grub> boot

and we soon see . . .

login:

Success!!!

Conclusion 

GRUB is a nice bit of kit not only for booting your favorite OS, but also for rescue and recovery work. Simple to use, but uutterly complex in the depth of ssophisticationit offers, you owe it to yourself to check it out.

Web Resources 

GNU GRUB http://www.gnu.org/software/grub/grub.html

GRUB HOWTO by Fabio Fracassi http://archive.linuxfromscratch.org/lfs-hints/html/GRUB-Howto.html

This one is good for keyboard key translation examples.

Multiboot with GRUB Mini-HOWTO http://www.linuxdoc.org/HOWTO/mini/Multiboot-with-GRUB.html

Useful Commands 

We have explored the more common GRUB commands. Here are some others that you may find useful

cat

prints the contents of a file.

color

if you want to get fancy, add colour to your menu. Try color green/black light-green/black. Go crazy, Fabio.

find

search for the FILENAME in all the partitions and print a list of devices where the file is found.

geometry

print the geometry of the device. From the shell, you can set the geometry of the drive if necessary.

setkey

allows you to remap keys on your keyboard

splashscreen

you can use a splashscreen if you just need to feel pretty.

terminal

use a remote terminal when booting

Multiboot with GRUB Mini-HOWTO 

http://en.tldp.org/HOWTO/Multiboot-with-GRUB.html

Ivan Kanis, ivank@juliva.com v1.0, 2001-01-15

This document describes how to install Windows 98, Windows 2000, DOS and Linux using GRUB.

1 Preparing boot floppies 

You will need 3 floppy disks. Make the first floppy a DOS bootable disk. Copy fdisk.exe and sys.exe onto this floppy disk.

FORMAT /S A:
COPY FDISK.EXE A:
COPY SYS.EXE A:

Use your second floppy disk to make a Windows 98 emergency disk. You will use the third floppy for GRUB shortly.

2 Installing linux 

Install your favorite distribution of linux. You will need to use fdisk to partition your hard disk. Calculate ahead of time how much disk space each of your operating systems will take.

Here is how I partitioned my hard disk:

   Device Boot    Start       End    Blocks   Id  System
/dev/hda1             1         6     48163+  16  Hidden FAT16
/dev/hda2             7        19    104422+  16  Hidden FAT16
/dev/hda3            20       593   4610655   1b  Hidden Win95 FAT32
/dev/hda4           594      3737  25254180    5  Extended
/dev/hda5           594       848   2048256    6  FAT16
/dev/hda6           849      2123  10241406    7  HPFS/NTFS
/dev/hda7          2124      2140    136521   82  Linux swap
/dev/hda8          2141      2523   3076416   83  Linux

My first partition is for booting Windows 2000. 10MG should be plenty to do that. This partition will only contains the file necessary to boot NT such as boot.ini, ntldr, ntdetect.com, etc… NT will reside in partition 6 in my example. This partition is Hidden FAT16.

The second partition is for DOS. I deemed 100M sufficient. This is FAT16 too

The third partition is for Win9x. I gave it 5G and made it FAT32 for performance.

Next create the extended partition for the remaining of your hard disk. This shows up as partition 4 on fdisk.

Create a 2GB partition. This partitions is used to share data between all operating systems. Make sure that all the sum of all above partitions are less than 8GB. This is a DOS limitation.

Next create your Windows 2000 partition. I gave it 10G since this breed of windows is a bloated pig. I made it a HPFS/NTFS partition for speed.

Next add your swap partition and linux partition. Make sure you do not have a separate partition for /boot. Things look better in GRUB if you keep /boot in the root partition.

After you have installed linux go ahead and format the fat16 partitions:

mkdosfs /dev/hda1
mkdosfs /dev/hda2
mkdosfs /dev/hda6

3 Installing GRUB 

Make sure you have the latest version of GRUB. I am using version 0.5.96.1. The version that came with my distribution was out of date and gave me a lot of grief. You can download the latest version at http://www.fsf.org.

Now you'll want to install GRUB on the floppy disk. You don't want to install it on the hard disk yet because Windows 2000 will overwrite it.

grub-install '(fd0)'

Create the following menu.lst for GRUB. This file lives in /boot/grub.

#
# Sample boot menu configuration file
#

# Boot automatically after a minute.
timeout 60

# By default, boot the second entry.
default 1

# Fallback to the first entry.
fallback 0

title Windows 2000
unhide (hd0,0)
hide (hd0,1)
hide (hd0,2)
rootnoverify (hd0,0)
chainloader +1
makeactive

# For booting Linux
title  Linux
root (hd0,7)
kernel /boot/vmlinuz-2.2.17 root=/dev/hda8 video=matrox:vesa:261

title Windows 98
hide (hd0,0)
hide (hd0,1)
unhide (hd0,2)
rootnoverify (hd0,2)
chainloader +1
makeactive

title DOS 6.22
hide (hd0,0)
unhide (hd0,1)
hide (hd0,2)
rootnoverify (hd0,1)
chainloader +1
makeactive

# For booting Linux
title  Linux (single user)
root (hd0,7)
kernel /boot/vmlinuz-2.2.17 root=/dev/hda8 video=matrox:vesa:261 single

title Partition 2 (floppy)
hide (hd0,0)
unhide (hd0,1)
hide (hd0,2)
chainloader (fd0)+1

title Partition 3 (floppy)
hide (hd0,0)
hide (hd0,1)
unhide (hd0,2)
chainloader (fd0)+1

Check that you can boot linux with the floppy disk. If you are having trouble you can drop in GRUB's command line and figure out what is going on. GRUB is very well documented, if you have any trouble please take a look at the documentation.

4 Installing windows 2000: 

I had to initialize the first partition before installing windows 2000. Insert the DOS startup disk and reboot your computer. Once you get to the DOS prompt do the followings:

FDISK /MBR
SYS C:

Now you can go ahead and install windows 2000. At some point Windows 2000 will prompt you for the partition on which you want to install. The partition you created with fdisk should show up as damaged or unformatted partition. Go ahead and select it.

To hide the Windows 2000 menu edit a file called boot.ini that should be in the C: drive. Change the timeout value from 30 to 0.

[boot loader]
timeout=0
default=multi(0)disk(0)rdisk(1)partition(1)\WINNT
[operating systems]
...

5 Installing DOS. 

Insert the GRUB disk. When you see the menu insert the DOS boot disk. Select partition 2 (floppy) from the menu.Hit enter. This will boot the floppy disk and hide partition 1 and 3.

Run FDISK and check that the C: drive is partition 2. Next install DOS:

SYS C:

6 Installing Windows 98 

Insert the GRUB disk. When you see the menu insert the Windows 98 Emergency disk. Select partition 3 (floppy) from the menu.Hit enter. This will boot the floppy disk and hide partition 1 and 2.

Run FDISK and check that the C: drive is partition 3. Next install Windows 98:

SYS C:

7 The final touch 

Test that everything is working from GRUB:

You should be able to boot from all 4 operating systems from the GRUB floppy disk.

If everything looks right you can go ahead and install GRUB on your hard disk. From linux type:

grub-install /dev/hda

You should now be able to boot all 4 operating systems from the GRUB menu. Enjoy!

Grub interactive 

Newsgroups: comp.os.linux.setup
Date: Tue, 18 Feb 2003 07:40:41 -0800
> Using Lilo, I can interactively choose what I will boot, e.g.:
>
> boot: linux single
>
> boot: linux ks=floppy
>
> I can also pass all kinds of parameters to kernel. How can I do this with
> grub?

Grub is far more flexible in terms of choosing things at boot time. You can put additional boot entries in /boot/grub/menu.lst. You do not need to run the equiv of lilo after editing the file. With grub, you can also edit the entries at boot time. Say you mistyped the kernel path, you can edit it from the grub menu, with lilo you're fu**ed. It's one tool that is very worth while learning. You'll never go back to lilo. You gotta read the docs though :-)

-Bruce

Grub interactive 

> Thanks everyone for the respond, I've went through the grub info
> node (actually many times), but still I don't know how to boot my
> linux into single mode (maybe my lack of linux booting knowledge
> counts) please help. Thanks

It's a matter of passing initial run level to the kernel (LILO does exactly the same thing). If you already have a grub menu entry, edit it to add 1 or S after your kernel name. That's all. Likewise, you can create entries to - or interactively boot into console mode (3) or graphics mode (5). Of course, you can also shut it down immediately (0) or, just for fun, reboot it immediately (try pass 6 into default entry).

Yuan Liu

boot loader for 2 seperate hard drives 

http://wolvix.org/node/781#comment-3047

in the grub menu file … I changed the file to read:

Title Windows XP
 rootnoverify (hd1,0)
 map (hd0) (hd1)
 map (hd1) (hd0)
 chainloader +1

These 2 articles helped alot they led me in right direction anyway : http://www.linux.com/articles/113945?tid=129&tid=49 https://www.redhat.com/archives/valhalla-list/2003-February/msg00732.html even though there example didnt work for me,, I also tried the dd boot copy method transplant to windows with no luck… Any way I am Happy wolf Howling tonight, 2 os with no messy boot disks , clean and simple.

documented on: 2007-09-18, madwagon

Dual boot dual disk 

https://www.redhat.com/archives/valhalla-list/2003-February/msg00732.html

> I have a box that I want to be dual boot (windows and linux), each
> operating system on a separate disk.
>
> I built the WindowsXP disk first (FAT32) on a master IDE disk, then made the
> Windows disk a slave and installed a blank disk as master, and ... installed
> RH7.3 on it . . .

If you wouldn't have moved the windows disk, it would have worked. Windows doesn't like to be a slave (pun intended), so you need to have grub remap the hard drives, so that windows will think that it is the master. In your grub.conf file, change your windows section to something like this:

title WindowsXP
       map (hd0) (hd1)
       map (hd1) (hd0)
       rootnoverify (hd0,0)
       chainloader +1

The map commands are the key.

ForrestX Taylor @intel.com

Dual boot dual disk 

Reference:
Convert a Windows system to dual-boot Linux on a second drive http://www.linux.com/articles/113945?tid=129&tid=49 By Philip J. Hollenback on February 21, 2005

GRUB and non-first HDD 

Newsgroups: comp.os.linux.setup
Date: 2002-10-17 17:36:34 PST

I'm having some problems getting my Windows partition to boot using GRUB. GRUB's installed on the MBR of the 1st disk; I've got the following hdd setup:

# First HDD (master)
ext3 /boot on hd0,0 (bootable)
swap on hd0,1
ext3 / on hd0,2
(Logical FAT partition on hd0,3)
# Second HDD (slave)
FAT32 Primary Partition on hd1,0 (bootable)

I can boot the 2nd hdd into Windows via the bios if necessary (hence, the MBR is intact).

I've tried variations of the following at the grub command line:

grub > map (hd0) (hd1)
grub > map (hd1) (hd0)
grub > unhide (hd1,0)
grub > hide (hd0,3)
grub > rootnoverify (hd1,0)
grub > chainloader (hd1,0)+1
grub > makeactive
grub > boot

(I was able to boot Windows on the 2nd hdd via the grub command line before I created the logical FAT32 volume on the 1st hdd).

Craig

GRUB and non-first HDD 

I finally got it working like this:

# Swap the drives around so that Windows thinks it is master
grub > map (hd0) (hd1)
grup > map (hd1) (hd0)
# Tell it where the Win boot partition is
grub > rootnoverify (hd1,0)
grub > chainloader +1
grub > makeactive
grub > boot

Craig

GRUB and non-first HDD 

> I'm having some problems getting my Windows partition to boot using GRUB.
> GRUB's installed on the MBR of the 1st disk;

I got mine to boot windows on the primary slave by using LILO. I couldn't figure out the commands for GRUB, they didn't make sense. I have posted my LILO config in case you decide you want it :)

# lilo.conf
prompt
timeout=40
default=Windows
boot=/dev/hda
map=/boot/map
install=/boot/boot.b
message=/boot/message
linear
image=/boot/vmlinuz-2.4.7-10
 label=Redhat
 initrd=/boot/initrd-2.4.7-10.img
 read-only
 root=/dev/hda2
 append="hdd=ide-scsi"
other=/dev/hdb
 label=Windows
 map-drive=0x80
        to=0x81
 map-drive=0x81
        to=0x80
#  Must make sure to put at least 2 hash symbols (#)
#  for some reason LILO needs them
# end lilo.conf

Will Mays

GRUB and Windows - Yet Again! 

Newsgroups: alt.os.linux.mandrake
Date: 2003-02-05 01:49:13 PST
> title Windows 2000
> map (hd0) (hd1)
> map (hd1) (hd0)

Correct. You swap the drives around using the "map" feature of GRUB because you need to trick Windows into believing it's located on the first drive. But your next line,

> rootnoverify (hd0,0)

is not supposed to continue fooling Windows, because at this stage you're telling the GRUB where to look for the partition to boot Windows from. Switch this around, it should be rootnoverify (hd1,0) here.

Ulrich Plate

GRUB and Windows - Yet Again! 

> Switch this around, it should be rootnoverify (hd1,0) here.

That was it! Urika, Hurray, and all that. Thankyou thankyou thankyou….

John

boot Windows from extended partition 

It's the problem of OS, not Partition Magic. DOS, Win95/NT can only boot from primary partition only, other OS (e.g OS/2) can boot from extended partition.

If you want to use several OS, you should create multi primary partitions by using Partition Magic. The problem is you can only access any one of the primary partition.

booting from extended partition 

Newsgroups: fa.freebsd.questions
Date: 2002-03-13 04:16:13 PST
> one advantage of Booteasy is that it keeps the last selected choice
> as the default for the next boot process. I haven't found such a
> feature neither in Lilo nor in Grub.

Grub doesn't make the last selected choice the default by default; you have to do it in the boot entry in the menu with the "savedefault" command. That will make the entry currently booting the default entry next time you boot. I.e., mine looks like:

title FreeBSD-stable
savedefault
root (hd0,1,a)
makeactive
kernel /boot/loader
title FreeBSD-current
savedefault
root (hd0,3,a)
makeactive
kernel /boot/loader
title TurboLinux
savedefault
root (hd0,2)
kernel /boot/vmlinuz root=/dev/hda3
title Floppy
root (fd0)
chainloader +1

If I boot to Linux or FreeBSD, it makes that the default next time. If I boot from floppy, it doesn't - which behavior I much prefer.

mike

booting from extended partition 

> > have to do it in the boot entry in the menu with the "savedefault"
> Tank you. This is what i've been looking for!

You're welcome. Twice, as I wrote the code that implements that.

> > title FreeBSD-stable
> > savedefault
> > root (hd0,1,a)
> > makeactive
> > kernel /boot/loader
> Is `kernel /boot/loader' better with FreeBSD than `chainloader +1'?
> (I sometimes map in another BSD on the forth partition.)

Using /boot/loader skips the need for a boot block on the partition. Other than that, I don't think there's any difference.

mike

booting from extended partition 

> Are there OSes that don't have some kind of boot block in their own
> partition (or maybe in the extended partition) ?

Not that I know of. But I always use the way described in the grub info document for each OS if I'm going to boot that OS.

mike

How to boot CDROM with Grub 

Newsgroups: comp.os.linux.setup
Date: 12 Feb 2003 22:03:49 -0500

How can I add an entry in my grub boot menu to boot cdrom?

The problem is that grub manual says that IDE/EIDE/SCSI are all called hd, but my grub can only show two of my true HDs, not cdrom:

grub> root (hd
Possible disks are:  hd0 hd1
hda: Maxtor 6Y060L0, ATA DISK drive
hdc: SONY CD-RW CRX195E1, ATAPI CD/DVD-ROM drive
hdd: WDC WD205AA, ATA DISK drive

What grub said about hd1 is actually not my hdc (CD-RW), but my hdd.

How to boot CDROM with Grub 

Grub can't boot cdrom.

Reason: no corresponding BIOS drive for the cdrom.
% dmesg | grep -i sony
hdc: SONY CD-RW CRX195E1, ATAPI CD/DVD-ROM drive
% grub-install --recheck /dev/hdc
Probing devices to guess BIOS drives. This may take a long time.
/dev/hdc does not have any corresponding BIOS drive.
% dir /dev/cdrom
lrwxrwxrwx    1 root     root            9 Dec  9 22:21 /dev/cdrom -> /dev/scd0
% grub-install --recheck /dev/scd0
Probing devices to guess BIOS drives. This may take a long time.
/dev/scd0 does not have any corresponding BIOS drive.
—recheck

Recheck the device map, even if `/boot/grub/device.map' already exists. You should use this option whenever you add/remove a disk into/from your computer.

GRUB launch a CD 

Newsgroups: gmane.linux.debian.user
Date: Fri, 27 Apr 2007
> I've got an old Compaq laptop.  It can boot from hard
> drive or floppy but not from CD...
> Is there a way to tell GRUB to boot a CD?

Yes there is! Look here:

http://www.mail-archive.com/bug-grub@gnu.org/msg06678.html

I use this on several machines. It works finer than frog hair.

Roby @Adelphia.net

GRUB launch a CD 

sbm (smart boot manager)

It comes on the Debian install disk as a floppy image which you dd to a floppy and use it to boot from.

It is available as a package also, evidently

David Dawson

Booting Windows 2000 from GRUB. 

Newsgroups: alt.linux
Date: 2002-07-11 10:03:31 PST

I have a little (or maybe not) problem with booting Windows 2000. … I have three possibilities ( Linux, Win98, Win2k) but when I choose Win2k nothing happens:

Booting 'Windows 2000'
rootnoverify (hd0,5)
chainloader +1
+ (here is white heart)

I must choose Windows 98 first, NTLoader loads, then finnaly I choose Windows 2000.. Is there any way to make it boot from GRUB directly…?

sqbell

win2k ` linux ` win98 

Newsgroups: alt.os.linux.mandrake
Date: 2001-07-02 03:03:11 PST
> I've been trying to boot win2k, mandrake8.0 and win98 with lilo or
> grub but I can't make it work.
> On my first hard disk, I've installed windows 98 on a 2 GB primary
> partition and windows 2k on a 20 GB logical partion (hda5). At the end
> of the disk I've got a 8 GB fat32 logical partiton.
> Mandrake is on my second disk.
> I' like to boot these trhee OS's with lilo, grub, NT bootloader or
> bootmagic. I've tried them all but I can't get them to work correctly.
> [...]
> When I try using Grub, I get an error message when I try to boot
> directly to windows 2000.

I have this setup and use GRUB with no problem. Make sure that you copy across the following files to the Win2k partition:

NTLDR
NTDETECT.COM
BOOT.INI

I also found that I needed to change the rdisk number in boot.ini to be zero - it obviously decides that the disk that it resides on is disk 0 regardless of what anything else thinks.

Andy

win2k ` linux ` win98 

> [...] Make sure that you copy
> across the following files to the Win2k partition [...]

If you have bootable FAT/NTFS partition when installing NT/2k, then it will install bootfiles on this partition. With Partition Magic I always disabled all other partitions, installed Win2k (now it puts its boot files on the "only" own partition) and then enabled other partitions back.

If you cannot/do not want to do it, then the above advice may help. Be warned that you will have problems with any SW that modifies boot.ini *and* with service packs (they all still assume you have these files in original location).

=arvi=