03.09.2014, 08:09 UhrDeutsch | English
Hallo Gast [ Registrierung | Anmelden ]
Information about the GRUB boot manager

Originally taken and translated from Kano's homepage, http://kanotix.com/info/faq_d_grub.html,
(in order to have all the information in one place)

General Information

GRUB is a boot manager, more useful than Lilo, xFdisk, etc., capable of starting operating systems from different partitions. GRUB is not dependent on block lists to find the files for the system start and can read a whole set of filesystems directly: ext2, ext3, reiserfs, ... (Linux), Fat32, Fat16 (Windows), UFS (BSD), Minix, and many more. GRUB handles the bios extension (it can also boot partitions above 8 GByte!) and doesn't have a 1024 cylinder barrier. It doesn't matter to GRUB where the kernel is physically, it only needs the designation of the partition and the path to the kernel being booted (this can also be a symlink). After changing the configuration (thus menu.lst) no program call is necessary as with Lilo, the new configuration will be read at the next boot. Grub: After Install

Characteristics of Kanotix

Kanotix uses GRUB exclusively with the CD boot and hard drive installation*. It can be installed directly in the MBR, or in the root-Partition and/or chainloaded from the existing bootloader in the MBR.

Drives designations/device names

GRUB does not differentiate between SCSI and IDE hard drives. (hd0?) is always the first drive, always the first non-removable drive in the boot sequence (setting in the BIOS), the first also whether it's IDE or SCSI. The counting method is unusual. The first partition on the first hard drive is called (hd0?,0). The primary partitions have the number sequence of 0-3, and the logical partitions then count up starting from 4. Grub Linux FreeBSD designation
 /dev/fd0 /dev/fd0 floppy disks (a: under Windows)
(hda0) /dev/hda /dev/ad0 first hard drive 
(hd0,0) /dev/hda1 /dev/!ad0s1 part.1 of hard drive 1 
(hd0,0,a) - /dev/ad0s1a 
(hd0,5) /dev/hda6 /dev/ad0s6 extented partition on hard drive 1 


All names for devices for GRUB are written inside parentheses (). One must be careful about the entries for the kernel, which need to be typed in the usual fashion for Linux, contrary to GRUB. The entries in the following example are both for the same partition, i.e., the fourth on the first drive. The upper line is the GRUB way of writing, while the second line is in the form typical for Linux:
root (hd0,3)
kernel /boot/vmlinuz root=/dev/hda4


Command Mode (Grub Shell)

A particularly pleasant feature of GRUB is the COMMAND mode. Press "C" and the GRUB shell appears. Thus one is able, even with an incorrect menu.lst, to find and to boot different systems and files (for example, the kernel).

In order to do a little testing, GRUB can also be started from a booted Kanotix in a root terminal. In the GRUB shell, all available instructions can be seen by typing "help". Detailed assistance is available with the "help <command>", typing quit brings you back to the Linux Shell (the GRUB shell is exited). In the GRUB shell the tab key functions similarly as in the Linux Shell, easing things a lot. Commands, hard drive designations and file names can be completed with the TAB key automatically.

GRUB offers the possibility with "find" to determine the location of the kernel and initrd before the actual boot. For instance, give GRUB the command
$ find /boot/vmlinuz

and it willl display the partitions which hold a kernel with the name vmlinuz in the "/boot" directory:
$ (hd0,3)
$ (hd1,0)


One can determine the available partitions with the command "geometry", "geometry (hd0?)"
for example, gives the following:
$ drive 0x80: C/H/S = 3648/255/63, The number of sectors = 58605120, /dev/hda
$ Partition num: 0,  Filesystem type is fat, partition type 0xb
$ Partition num: 1,  Filesystem type is fat, partition type 0xb
$ Partition num: 2,  Filesystem type is fat, partition type 0xc
$ Partition num: 4,  Filesystem type is ext2fs, partition type 0x83
$ Partition num: 5,  Filesystem type unknown, partition type 0x82
$ Partition num: 6,  Filesystem type is fat, partition type 0xb

After the kernel and a possibly existing initrd (or also miniroot.gz) are found, it can be started with
# "boot"


Edit Mode

This mode makes it possible to change the entries in "menu.lst" during the boot. This also works if GRUB is booted from the CD and menu.lst is write protected. In order to do this, the "e" key must be pressed twice. The parameters are then simply written at the end of the line. You can use the arrow keys to move around the line, backspace and delete to remove things and enter to finish editing the line. 1-Grub screenshot and 2-Grub screenshot

menu.lst (Examples of entries)

Comment lines are introduced with # and do not disturb the boot procedure, they can remain in the file.
# /boot/grub/menu.lst ################################################
# setkey changes the key assignment of the German keyboard
setkey  y z
setkey  z y
setkey  Y Z
setkey  Z Y
setkey  equal parenright
setkey  parenright parenleft
setkey  parenleft asterisk
setkey  doublequote at
setkey  plus bracketright
setkey  minus slash
setkey  slash ampersand
setkey  ampersand percent
setkey  percent caret
setkey  underscore question
setkey  question underscore
setkey  semicolon less
setkey  less numbersign
setkey  numbersign backslash
setkey  colon greater
setkey  greater bar
setkey  asterisk braceright

# Adjusts the time in seconds, after it is automatically rebooted
# in this time the Edit and/or Command mode can be called with "e" or "C" 
timeout 30

# sets the system default after which timeout it will be booted
default 0

# Notes the last booted partition if "save default" appears under Title
#default saved

# wird gebootet, falls das Booten des Default-Eintrages fehlschlägt
fallback 1

# Specify foreground/background colours
# Selection: blink red background: blue
color white/blue blink-red/blue

# Entry 1 is default 0 and boots for example Windows 98 #################
title Windows 98 (Partition 1 auf Platte 1)
rootnoverify (hd0,0)
makeactive
chainloader +1

# Entry 2 is default 1 and boots for example Windows 2000 ###############
title Windows 2000 (Partition 2 on disk 1)
rootnoverify (hd0,1)
makeactive
chainloader /bootsect.dos

# Entry 3 is default 2 and boots Suse #######################
title Suse-Linux
root (hd1,5)
kernel /boot/vmlinuz root=/dev/hdb6 read-only
# other parameters are also possible, e.g.:
# kernel /boot/vmlinuz root=/dev/hdb6 single
# kernel /boot/vmlinuz root=/dev/hdb6 vga=ask

# Entry 4 is default 3 and boots Debian #####################
title GNU/Debian (first extended partition on disk 2)
root (hd1,4)
kernel /boot/vmlinuz root=/dev/hdb5 read-only

# Entry 5 is default 4 und boots DOS from hard drive #########
title DOS (Partition 3 on disk 1)
root (hd0,2)
makeactive
chainloader +1

# Entry 6 is default 5 and boots from floppy ###########
title Floppy
chainloader (fd0)+1


Booting from a second hard drive (e.g. several Windows installations)

Some people need/want several Windows installations. Windows always wants however to start from the first drive. We must thus hide a partition and activate another. One should enter the following commands on the GRUB command line and after success edit the menu.lst file . That should the be done for each Windows partition. Do not forget to backup ! ;-)
hide (hd0,0)                          #hide partition 1 from the first drive 
unhide (hd0,1)                           #make partition 2 from the first drive visible
rootnoverify (hd0,1)                   #make partition 2 from the first drive to root filesystem
makeactive                                 #make partition 2 of the first drive active
chainloader +1                        #points to the first sector of the starting partition
boot                                          #boot the operating system


If you want to start another Windows from a second drive, virtually switch drives 1 and 2. Thus Windows will be tricked into seeing it as a first drive:
map (hd0) (hd1)
map (hd1) (hd0)


Stolperfallen (EN)

GRUB doesn't know about the 1024 cylinder boundary and can boot systems above the 1024 cylinders, but /boot/grub/stage2? must be thus reachable by the bios (also, be located within).

Stage2? may not be moved after the installation or have its location changed (e.g. Defrag could try moving it). Files are written with the setup, which then would not work anymore. It makes sense to provide stage2? with writing protection (you must be in the current directory):
DOS: attrib +r +s stage2
UNIX: chmod a -w ./stage2


Getting Curious?

... then I invite you to get a GRUB floppy image and experiment a little with it. There are also a functioning FreeDOS? and an editor on the disk. If you remove the write protection of the floppy, you can edit the menu.lst file on the disk to fit your circumstances.

Download (ca. 580 kB)

You can find the official GRUB FAQ at: GRUB Legacy FAQ

As long as the computer has a supported network card, Grub can also boot over a network. An appropriate boot disk can be created and then downloaded from
http://os.inf.tu-dresden.de/~fm3/grub.html (however with an older version of Grub).

* Modified from original page, as Grub in now used for the HD-Install, instead of Lilo, since BH6 and earlier.
XML Revisions of $tag
Seiten-History :: Letzter Editor : Richard :: Eigentümer : OffTopic ::
Powered by pnWikka 1.0
 
 
Deutsch | English
Logos and trademarks are the property of their respective owners, comments are property of their posters, the rest is © 2004 - 2006 by Jörg Schirottke (Kano).
Consult Impressum and Legal Terms for details. Kanotix is Free Software released under the GNU/GPL license.
This CMS is powered by PostNuke, all themes used at this site are released under the GNU/GPL license. designed and hosted by w3you. Our web server is running on Kanotix64-2006.