########### # Grub's Advantages # ########################################################################################################################################################################## ) - it is responsible for loading the kernel and guides the Linux system. GRUB can also boot other operating systems such as FreeBSD, NetBSD, OpenBSD, GNU Hurd, and DOS, and Windows 95, 98, NT, and 2000. Although the boot the operating system looks an ordinary and trivial task, it is actually important. If the boot loader does not work well or does not have flexible, it may lock the system without booting the computer. In addition, a good guidance loader can give you flexibility, allowing you to install multiple operating systems on your computer without having to handle unnecessary trouble. GRUB is a great Boot Loader. It has many functions that make the boot process very reliable. For example, it can read the Linux kernel directly from the FAT, Minix, FFS, EXT2 or REISERFS partitions. This means that it can always find the kernel anyway. In addition, GRUB has a special interactive console method that allows you to manually load the kernel and select the boot partition. This feature is invaluable: assuming that the GRUB menu is configured correctly, but can still boot the system. Oh, right - GRUB also has a color boot menu.
More amazing is that this is a free software! ! !
########### # GRUB menu # ########### first look at an example, this is located / The menu.lst file under the Boot / Grub / directory. This file will start a menu on the boot, including Debian Linux, Windows2000, Redhat Linux, and Mandrake Linux, a total of four selection. I have divided 8 districts, a FAT16 (0x6), a NTFS (0x7), three EXT2FS partitions (0x83), a SWAP partition (0x82). NTFS is used to install Win2000, three EXT2Fs have three Linux, and the C disk FAT16 partition is not installed. # Example
################################################################################################# #####
Timeout 10 Default 2
# -> Debian Linux <-
Title Debian Linux root (HD0, 2) kernel /boot/vmlinuz-2.2.18 root = / dev / hda3 ro initrd /boot/initrd-2.2.18.gz
# -> Debian End <-
# -> Windows menu option <-
Title Windows2000 Root (HD0, 0) ChainLoader 1 # -> WINDDOWS End <-
# -> redhat linux menu option <-
Title Redhat Linux root (HD0, 8) CHAINLOADER 1 # installed LILO in the main guidance partition of the hard disk, so it also used ChainLoader.
# -> redhat linux end <-
# -> Mandrake Linux menu option <-
Title Mandrake Linux root (HD0, 5) kernel /boot/vmlinuz-2.4.3-20mdk root = / dev / hda6 Ro initrd /boot/initrd-2.4.3-20mdk.img
# -> Mandrake Linux End <-
# Example to end
The row at the beginning of the symbol well "#" is commented, there is no meaning.
Timeout represents the default waiting time, here is 10 seconds. For more than 10 seconds, the user has not made a selection, and the system will automatically select the default operating system.
The default operating system is controlled by Default. DEFAULT adds a number N, indicating that it is N 1. It should be noted that in GRUB, the count starts from 0, the first hard disk is HD0, the first floppy drive is FD0, and so on. So, Default 2 indicates that the default operating system is Redhat Linux here.
Next, as you think, Title means "Debian Linux" menu item. ROOT (HD0, 2) represents the first hard disk, the third partition. The root of the root here is different from the ROOT partition and its difference, this root is not a root!
In Linux, when it comes to the "root" file system, it is usually the main Linux partition. However, GRUB has its own root partition definition. GRUB's root partition is a partition that saves the Linux kernel. This may be your formal root file system, or may not be. We discuss GRUB, you need to specify the GRUB root partition. When entering the root partition, GRUB will install this partition into read-only type so that the Linux kernel can be loaded from the partition. A very "cool" function of GRUB is that it can read this machine's FAT, FFS, Minix, EXT2, and Reiserfs partitions.
So far, you may feel a little confused because the hard disk / partition naming conventions used by GRUB are different from the naming conventions used by Linux. In Linux, the fifth partition of the first hard disk is called "HDA5". GRUB is called "(HD0, 4)". GRUB's number of hard drives and partitions is calculated from 0. In addition, the hard disk and partition are separated by commas, and the entire expression is enclosed with parentheses. Now, you can find that if you want to boot Linux hard drive HDA5, you should enter "Root (HD0, 4)".
Know where the kernel is, but also specifically pointed out which file is a kernel file, which is the work of Kernel. Kernel /boot/vmlinuz-2.2.18 root = / dev / hda3 RO Description /Boot/VMLINUZ-2.2.18 is the kernel to be loaded. The following are the parameters passing to the kernel. Root = / dev / hda3 is Linux's hard drive partition representation, RO is readonly meaning. Initrd is used to initially Linux Image and set the corresponding parameters. Is it very simple? Let's take a look at the definition of Windows. Here, I added an item to boot Windows2000. To do this, GRUB uses "Chain Loader" (CHAINLOADER). The chain loader is loaded into the WIN2000 its own boot loader in the boot record of the partition (HD0, 0), and then guides it. This is why this technology is called chain load - it creates a chain from the boot loader to another. This chain load technology can be used to guide any version of DOS or Windows.
My RedHat Linux installed LILO in the hard drive main partition, so I also used ChainLoader.
GRUB's configuration file is simple and so simple. If you want to be more personalized, try to put "color light-gray / blue" plus below the default statement, see what changes, then Try "color light-blue / red", surprise? Interest!
############### # Grub interactive # ####################################################################################################################################################################################################################################################
One of the best advantages of GRUB is its robust design - please don't forget this when you continue to use it. If you update the kernel or change it on the disk, you don't have to reinstall GRUB. In fact, if necessary, just update the menu.lst file, everything will remain normally.
Only in a few cases, you need to reinstall the GRUB boot loader to the boot record. First, if you change the partition type of the GRUB root partition (for example, change from EXT2 to Reiserfs), you will need to reinstall. Or, if you update the Stage1 and Stage2 files in / boot / grub, you are likely to reinstall the boot loader because they come from the updated version of GRUB. In other cases, you can ignore it!
The biggest feature of GRUB is very interactive. When booting, press "C" to enter the GRUB console. The display is as follows:
GRUB VERSION 0.5.96.1 (640K Lower / 3072K Upper Memory)
[Minimal bash-like line editing is supported. For the first word, Tab Lists Possible Command completions. Anywhere Else Tab Lists the Possible Completions of a device / filename.]
GRUB>
Welcome to the GRUB console. Now, reproduce the command: I will bypass LILO through the GRUB console to launch Redhat Linux.
Grub> root
Now press the Tab button. If there are multiple hard drives in the system, GRUB will display a list of possible completion, starting with "HD0". If there is only one hard drive, GRUB will insert "HD0,". If there are multiple hard drives, continue, enter the name in ("HD2") and enter the comma with the name, but do not press Enter. Partial completed root commands look like: grub> root (HD0,
Now, continue, press the Tab key. GRUB will display a list of all partitions on a particular hard disk, as well as their file system types. In my system, get the following list when pressing the TAB button:
grub> root (hd0, (tab, press the tab click button) Possible partitions are: Partition num: 0, Filesystem type is fat, partition type 0x6 Partition num: 2, Filesystem type is ext2fs, partition type 0x83 Partition num: 4, Filesystem type unknown, partition type 0x7 Partition num: 5, Filesystem type is ext2fs, partition type 0x83 Partition num: 6, Filesystem type is fat, partition type 0xb Partition num: 7, Filesystem type is fat, parttion type 0xb Partition num: 8, FileSystem Type IS Ext2fs, Partition Type 0x83 Partition Num: 9, FileSystem Type Unknown, Partition Type 0x82
If you see, GRUB's interactive hard drive and partition name implementation feature is very organized. These, just understand the GRUB novelty hard disk and partition name syntax, then continue to operate GRUB> root (HD0, 8) Now installed the root file system is installed, when the kernel is loaded.
Grub> kernel /boot/vmlinuz-2.4.2 root = / dev / hda5 ro [Linux-bzimage, setup = 0x1200, size = 0xe1a30]
You have installed the root file system and load the kernel. Now you can guide it. As long as you enter "boot", the Linux boot process will start. Is it very cool, GRUB's menu.lst is more like a script under Linux.
#################### # GRUB boot disk # ############# 要 要 制Dans, you need to perform some simple steps. First, create an EXT2 file system on a new floppy disk. Then, install it and copy some of the GRUB files to the file system, and finally run the "GRUB" program, which will be responsible for setting the floppy boot sector. Ready?
Insert an empty disk into a 1.44MB floppy drive, enter:
# MKE2FS / DEV / FD0 After you create an EXT2 file system, you need to install the file system:
# mount / dev / fd0 / mnt / flopp Now now you need to create some directories and copy some key files (these files have been installed when you install GRUB) to floppy disk:
# MKDIR / MNT / FLOPPY / BOOT # MKDIR / MNT / FLOPPY / BOOT / GRUB # CP / Boot / Grub / Stage1 / MNT / FLOPPY / BOOT / GRUB # CP / Boot / GRUB / Stage2 / MNT / FLOPPY / BOOT / GRUB There is another step to get the available boot disk. In Linux Bash, "GRUB" is run from the root user, which is very interesting and worth noting because it is actually a semi-functional version of the GRUB boot loader. Although Linux has been launched and running, you can still run GRUB and perform some tasks, and its interface is identical to the interface (ie, the GRUB console) when you use a GRUB boot disk or the GRUB is installed to the hard drive MBR. At the GRUB> prompt, enter:
GRUB> root (fd0) GRUB> Setup (fd0) GRUB> quit
Now, the guide disk is completed. It is easy if you want to put the grub on the hard disk. This process is almost the same as the guide disk installation process. First, you need to decide which hard disk partition will become a root grub partition. On this partition, create the / boot / grub directory, and copy the Stage1 and Stage2 files to this directory, you can perform the following step by rebooting the system and using the boot disk, or using the resident version of GRUB. In both cases, start the grub and specify the root partition with the root command. For example, if you copy the Stage1 and Stage2 files to the HDA5 / boot / grub directory, you should enter "Root (HD0, 4)". Next, decide where to install GRUB - MBR on the hard disk, or if another "master" boot loader with GRUB is used, the boot record is installed in a particular partition. If you install it to the MBR, you can specify the entire disk without having to specify the partition, as follows (for HDA):
GRUB> Setup (HD0)
If you want to install the GRUB to the boot record of / DEV / HDA5, you should enter:
GRUB> Setup (HD0, 4)
GRUB is now installed. When booting the system, you should immediately end (if you install it to MBR) immediately after GRUB. Now, the boot menu should now be created so that you do not have to enter those commands every time you boot your system.
Summary: Only part of GRUB is described here. For example, you can use GRUB to perform network boot, boot the BSD file system, or more operations. In addition, GRUB has many configuration and security commands. For a complete description of all GRUB functions, read the excellent GNU documentation in GRUB. You can read this document as long as you enter "INFO GRUB" in the BASH prompt.