Hard disk partition table and LILO multiple boots

xiaoxiao2021-03-06  206

With Linux's boom, many computer enthusiasts are not strange to it. However, if you don't know the relationship between the hard disk partitioning table and the bootstrap LILO, many beginners have a feeling of foggy. This article is to analyze the hard disk partition table and LILO, so that beginners have a deeper understanding of this, and better use LILO.

Hard disk partition table

Each hard disk has a primary guiding sector, namely the first sector of the 0th cylinder of the disc, which is maintained on some of the critical information about this hard disk. Its structure is: Main Boot Record (MBR) Hard Disk Partition Table (DPT) Main Boot Sector Effective Sign. The MBR is used to store the boot program; the effective flag is two bytes, and its value is generally AA55 (16), indicating that this hard disk is available, and the system will depend on this hard disk when it is other value. You cannot access it. As shown in Figure 1.

The hard disk partition table is mainly introduced. The hard disk partition table is divided into four records, record information on four partitions on the hard disk, that is, a hard disk can be divided into 1 to 4 logical partitions. These four partitions are independent of each other, each occupying a complete continuous area, the logical sector number in the partition is set out from 0, just like a separate hard disk, so you can use a hard drive as many A hard drive is used. Different file systems (such as FAT, FAT32, NTFS, Linux EXT2, etc.) and operating systems (such as DOS, Windows 98 / NT, Linux et al.) Can be loaded in each partition. There is an activity flag (boot flag) bit in each partition record, which indicates the system from the partition, which is booted when booting the operating system in the partition, and only the four record items can be A event sign is 1; when the four event markers are 0, the system will not be guided, but if the system is slamed from the floppy disk, the disc, other hard drives, NIC, the USB flash drive, this hard disk can be accessed.

In the four partitions described above, there is a main partition that can be set to extend the partition, and respectively referred to as the primary partition. In the extended partition, a logical drive can be set. The first sector and main boot sector of the extension partition is similar, just without MBR. The DPT structure in this sector is the same as in the main boot sector, just the content stored in the four record items is the information of the logical drive. In fact, we can also look like a logical drive as a partition, such a hard disk can be divided into 7 partitions.

Multi-system boot program LILO

LILO (Linux Loader) is the most common boot program in Linux, responsible for reading Linux's kernels into memory and handles control to kernel. LILO's biggest benefit is that it is independent of the file system and can start various operating systems. Now LILO configuration is relatively intuitive, mostly the graphical interface (GUI) or a monogram prompt, and various version of Linux generally configure LILO, more convenient, here is not described here. . For some beginners, there are still some basic knowledge that needs to be understood. Here is the problem that several frequently encounters.

1. Representation method of disk partition in Linux

Linux is called disk numbers in order, HD in the hard disk, the primary (MASTER) on the first hard disk controller, represents the second hard disk controller (SECONDARY IDE CONTROLLER) The disk is HDB, the slave (slave) on the first hard disk controller is HDC, and so on. Taking HDA as an example, the first partition in the hard disk partition table in the HDA is HDA1, the second is HDA2, and so on. If the extension partition is also divided, the logical drive in the partition is then row, such as HDA5, HDA6, and so on. 2. It is best to install LILO in Linux.

Most Linux now recommended that LILO is installed in the main boot record MBR (if installed on the first hard disk, it may be displayed to / hda), in fact, this is only to ensure that after installation is finished by LILO boot system. However, if you install other operating systems (such as Windows 98) after loading Linux, you may overwrite the MBR, so lilo will be lost, and Linux cannot start from the hard drive. If there is a Linux guided floppy disk, although you can also start Linux, it is much slower, it is inconvenient. Therefore, it is best to select the partition of LILO in Linux when installing (if it is the second partition of the first hard disk, it may be displayed to / hda2), and activate the partition with tools. Thus, even if the operating system covers the MBR, or when the activation partition is changed, it is only necessary to run the FDISK / MBR cleanup MBR, and the Linux partition is reactivated with FDISK to make LILO to reach the Qiwei.

3. Install LILO on the big hard disk

For historical reasons, the earlier PC BIOS can only access the hard disk space for 1024 cylinders. The Linux itself does not pass the BIOS to access the hard drive, but the LILO boot Linux is accessible to the hard disk through the BIOS, so if the Linux partition is not over before the 1024 cylinder, Linux will not start. Discuss how to install Linux in large hard disks, a general solution is to put a small partition / boot directory before 1024 cylinders, and then put other directory into other partitions. This approach must account for a valuable partitioning table space, and it is troublesome, and beginners are not easy to understand. In fact, the current computer has basically supported the LBA way to visit the big hard drive, and excellent Lilo, of course, has already supported a big hard disk. So when you install Linux on a big hard disk, if there is an LBA32 option, you will save a lot of trouble. If there is no LBA32 option, you can choose to make a boot floppy disk. After you install Linux, you will get Linux with a floppy disk, add a line LBA32 in the / etc directory, and then run Lilo. This operation can be done with the VI editor. Run the command in the / etc directory to start the VI editor, type "I" to enter the insert mode, enter "LBA32" (upper and lowercase can be), enter the loan, press ESC to exit the insert mode, Press ":" Enter the command mode, enter "X" to save exit. Don't forget to run the LILO command.

4. Realize multiple boots with LILO

After entering Linux, run the LinuxConf command, and then enter the LILO menu in the tree menu, you can add other operating systems. If the system does not provide a LinuxConf command, you can also edit the Lilo.conf file under the / etc directory to achieve the purpose. For example, if Windows 98 is installed in the third partition in the first hard disk, you can use the VI editor, add the following two lines at the end of lilo.conf: other = / dev / hda3

Label = windows98

Where Label is the name of the operating system. After saving exit, run LILO, so that the machine will make the option to start the Windows 98 when the machine is started. Adding other operating systems can be made such as methods.

Finally, give a demonstration document for lilo.conf for reference:

Boot = / dev / hda1

MAP = / boot / map

TIMEOUT = 50

LBA32

Prompt

Message = / boot / message

Default = windows2000

VGA = Normal

Root = / dev / hda1

Read-only

INSTALL = / boot / boot.b

Image = /BOOT /VMLINUZ-2.4.2-2

Label = Linux

Append = "HDC = IDE-SCSI"

Other = / dev / hda2

Label = windows2000

Other = / dev / hda3

Label = windows98

For beginners, you will clearly understand the hard disk partition tables to make it easier to learn and understand the bootstrap.

转载请注明原文地址:https://www.9cbs.com/read-128534.html

New Post(0)