Article Title: Linux boot management: Lilo and Grub. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
At present, the performance of the PC is getting stronger and stronger, especially the ultra-large capacity of the hard disk, so that we have enough places to install multiple operating systems. The most common startup software in Linux is LILO and Grub.
LILO is the default boot program for many Linux systems. It is short for Linux Loader and has powerful functions. Grub is also a multi-start manager. Its full name is Grand uniied Bootloader. Like LILO, Grub also provides the function of selecting the system to be guided when multiple operating systems coexist. It can guide many commonly used operating systems on PCs, including Linux, FreeBSD, Solaris, Windows 9x, and Windows NT. It can load the operating system kernel and initialize the operating system; the boot permission can be directly handed over to the operating system for guidance; the Linux kernel can be read directly from the FAT, minix, FFS, ext2, or ext3 partitions. Grub has a special interactive Console mode. You can manually mount the kernel and select the boot partition.
First knowledge of Grub and LILO
1. Advantages and Disadvantages of Grub and LILO
Grub appears later than LILO, so it can implement most of LILO functions, instead of LILO for Linux boot, especially for the coexistence of Linux and other operating systems.
◆ 8.4GB Problems
In the past, LILO of older Linux versions had the following problem: the boot/boot partition cannot be divided into more than 1023 cylinders, usually around GB, otherwise, LILO cannot be installed, or the system cannot be correctly booted after installation. Grub will not do this. As long as the hard disk is in LBA mode during installation, it can direct the root partition to an operating system other than 8 GB. At present, this problem has been well handled in the newer version of LILO.
◆ Beautiful Logo
The Grub boot mode displays a beautiful boot screen, which can be 640x480, 800x600, 1024x768, and other modes, and supports automatic selection of the best image mode. Linux enthusiasts can change this image to create a personalized boot screen.
LILO originated from the text interface, so it has limited support for the boot screen in the latest version.
◆ Execution Mode
Grub can not only boot through the configuration file, but also dynamically change the boot parameters before selecting boot, and dynamically load various devices. For example, if a new core is compiled in Linux, but you cannot determine whether it can work, You can dynamically change the Grub parameter during the boot. Even if the Grub menu configuration is incorrect, but the system can still be guided. Grub command lines have very powerful functions and support history functions such as bash. You can use up or down keys to find previous commands. LILO does not support this mode.
In LILO, You can manually enter the operating system name to guide different operating systems, or use a menu to select different systems for boot. Grub is also compatible with the above operations.
◆ Partition impact on Grub and LILO
LILO loads the operating system by reading the absolute sector on the hard disk. Therefore, you must reconfigure LILO for each partition change. If you adjust the partition size and partition allocation, LILO cannot boot the operating system of the partition before reconfiguration. Grub directly reads the core to the memory through the file system. Therefore, Grub can guide the system as long as the path of the core of the operating system remains unchanged.
Grub and LILO support multiple external devices, multiple file systems, dynamic loading of the operating system kernel, and even network-based loading of the operating system core. Grub also supports multiple executable file formats, automatic decompression, and multi-boot operating systems.
Comparison of Grub and LILO Parameters
1. Install
Run the "makebootable" command to install Grub. "Lilo-v" is to reinstall LILO. The LILO Boot Sector contains the space of a partitioned table. Therefore, LILO can be installed in either MBR or a partitioned Boot Sector. Grub and LILO can both be installed on a floppy disk. Creating a Grub boot disk is not much different from creating a LILO boot disk.
To create a boot disk, perform some simple steps. First, make sure that Grub or LILO has been installed and the ext2 file system is created on the new floppy disk. Then install the disk, insert an empty disk into the drive, and enter:
# Mke2fs/dev/fd0
After creating an ext2 file system, you must install the file system.
(1) install Grub
Go to the Grub directory:
# Cd/boot/grub
Put a floppy disk and execute the following command:
# Dd if = stage1 of =/dev/fd0 bs = 512 count = 1
# Dd if = stage2 of =/dev/fd0 bs512 seek = 1
The Grub boot disk is complete.
(2) install LILO
# Dd if =/dev/hda of =/dev/fd0 bs = 512 count = 1 (because LILO is already installed in MBR)
After executing the preceding command, the LILO boot disk is complete.
When Grub is started, a configuration file named menu. lst will be searched in/boot/grub/. If this file cannot be found, the configuration file will go to the command line mode without entering the menu mode. Menu. lst is a text file that can be opened in any text editor. Each line represents a configuration command. If the first character of a line is "#", it indicates that this line is a comment. You can simply add or remove a comment line to change the configuration. LILO uses a text file/etc/lilo. conf as its configuration file. LILO reads lilo. conf and writes specific LILO to the system boot Zone according to the parameters. If/etc/lilo. conf is modified, you must run the LILO command again to ensure that LILO runs properly.
Grub and LILO have many similar parameters, as shown in table 1.
Table 1 Comparison of Grub and LILO Parameters
Specific LILO parameters of Grub with similar functions
Boot the default Operating System timeout second timeout = tsecs after second seconds
Default start option default num default = name
Title OS mode label
Specifies the Linux Kernel path Kernel image
Specifies the path and file name of the file on the boot screen. Splash pathname/filename message = message-file
2. Configuration
(1) configuration of Grub and LILO (The LILO parameter is in brackets)
Specify the wait time for the default Operating System to boot:
Timeout second (timeout = tsecs)
The code above indicates that the default Operating System is guided after second seconds. If it is timeout 5, it is 5 seconds without other instructions to boot the system; if it is set to-1, Grub will wait until the user selects an option.
In LILO, timeout = 50 is also set to wait for the keyboard input time, in the unit of 0.1 seconds. If no input exceeds this period, the system times out and the default Operating System is automatically guided. If this parameter is not set, the default timeout length is infinite.
Specify the default Operating System for the boot:
Default num (default = name)
In Grub, the operating system of row num + 1 is started by default. If default is set to 1, 2nd systems are started. In LILO, default = name is used to specify the default operating system. For example, default = LINUX indicates that the operating system with label as Linux is used as the default Operating System. If this parameter is not specified, the first operating system in lilo. conf will be used as the default Operating System.
Specify the kernel of the boot operating system:
Kernel (image)
Specify the location of the kernel for Grub and specify the file that is the kernel file. For example, kernel/boot/vmlinuz-2.2.16 root =/dev/hda7 ro instructions/boot/vmlinuz-2.2.16 is to load the kernel, the following are passed to the kernel parameters. Root =/dev/hda7 is the partition where the Linux root partition is located. ro is read-only. LILO uses image = filename to specify the file or device that contains the startup options of a Linux kernel.
Specify the information file for operating system boot:
Splash pathname/filename (message = message-file)
The above Code specifies the path and file name of the Grub boot screen file. In LILO, the message = message-file command is used to specify a file containing the annotation information, which will be displayed before the system "LILO. If you want to obtain more information when starting LILO, You can edit this file and use this command. If the file contains characters with ASC Ⅱ code 0xFF (Ctrl + L), the screen is cleared. Note that the file size cannot exceed 65535 bytes. After each file change, you must re-run the LILO command to recreate the map file to ensure its normal display.
Specify the name of the boot operating system:
Title OS mode (label)
The characters pointed out in the code above are the options seen in the Grub menu item. You can write the operating system name and description, for example, title Linux and Single Mode indicate that this option is used to guide the Single user Mode of Linux. In LILO, label = name identifies the current operating system by using this parameter, that is, the operating system name. You can enter a name after the LILO prompt to guide a specific operating system.
(2) LILO configuration information
In LILO. conf, there are a maximum of 16 operating system options, which are more flexible than Grub. The LILO. conf configuration file consists of two parts: one is global configuration, and the other is Bootstrap configuration, and "#" indicates annotation.
◆ Global configuration of LILO
Global parameters are valid throughout the process. They can appear anywhere in the LILO. conf file.
Backup of boot operating system files:
Backup = backup-file
Force-backup = backup-file
Install = file
[1] [2] [3] Next page