lsg04.htm
来自「linux-unix130.linux.and.unix.ebooks130 l」· HTM 代码 · 共 3,109 行 · 第 1/5 页
HTM
3,109 行
<BR>
<LI>The NOINSTDEF parameter tells you that if the install option is omitted from the command line, don't install a new boot sector. Instead, modify the old one. This parameter is disabled by default.
<BR>
<BR>
<LI>ONE_SHOT disables the command line timeout if any key is pressed. This parameter is disabled by default.
<BR>
<BR>
<LI>READONLY prevents overwriting of the default command line sector of the map file. This parameter is disabled by default.
<BR>
<BR>
</UL>
<BR>
<A NAME="E69E46"></A>
<H4 ALIGN=CENTER>
<CENTER>
<FONT SIZE=4 COLOR="#FF0000"><B>Updating LILO</B></FONT></CENTER></H4>
<BR>
<P>If you want to update an existing version of LILO with a newer one, the process is the same as a first-time installation except that existing configuration files are renamed to .old. For example, chain.b is renamed to chain.old. If the new version of LILO behaves properly, you can delete the .old files. Whenever you update the version of LILO, you must update the boot sector to add the new locations and map file format. To update the boot sector, run LILO.
<BR>
<BR>
<A NAME="E68E20"></A>
<H3 ALIGN=CENTER>
<CENTER>
<FONT SIZE=5 COLOR="#FF0000"><B>Linux and Hard Disk Layouts</B></FONT></CENTER></H3>
<BR>
<P>To understand how LILO works, you must understand how a hard disk is laid out. You probably already know that a hard disk is essentially a set of concentric tracks, radiating out from the center of the disk platter. Each track is divided into a number of sectors.
<BR>
<P>Hard disks are identified by the number of platters (or more accurately, the number of heads; the number of platters can be greater than the number of heads because one or more surfaces, typically the top and bottom, might not be used for data storage), the number of tracks per inch of disk platter (measured radially), and the number of sectors per track. The capacity of each sector leads to the total capacity of the disk by multiplying by the number of sectors per track, the number of tracks, and the number of platters with heads.
<BR>
<P>Linux is usually integrally tied with DOS, so it is useful to look at the way DOS uses a hard disk. A single-purpose (single DOS operating system, for example) hard disk (and most floppy disks) has a boot sector, followed by a data area that includes an administrative block. The boot sector is the first sector on the hard disk and is read when the system starts to load the operating system. The boot sector contains a bootstrap to direct the machine to the startup routines. The data area stores files, including the operating system startup code. (A bootstrap is a short piece of code that tells the BIOS how to load the operating system. It essentially starts the operating system load process by providing the bare bones instructions necessary to read the operating system files from disk.)
<BR>
<P>Although the administrative block is usually part of the data area, users commonly cannot access it directly. Each file on the hard disk has an entry in the administrative block's tables that indicates the file's location in terms of the head, track, and sector and the file name. Other information, such as owner, permissions, date and time, is usually stored in the administrative block as well. In DOS, this information makes up the File Allocation Table (FAT); UNIX and Linux use the superblock or i-node tables. The administrative table is not usually read until the boot process has been started.
<BR>
<P>When the hard disk has lots of space, you will probably want to install more than one partition. Multiple partitions are especially useful if you want to support more than one operating system (DOS and Linux, for example) on the same hard disk. You can create up to four primary partitions on a DOS disk.
<BR>
<BLOCKQUOTE>
<BLOCKQUOTE>
<HR ALIGN=CENTER>
<BR>
<NOTE>With some operating systems, you can have more than four partitions, but if you are using DOS on the hard disk, don't create more than four primary partitions. Doing so may cause DOS to improperly read any data in the DOS partition because DOS has a built-in limitation of four partitions per disk. DOS' FDISK can't handle more than that amount. If you need to provide more than four logical disk drives, you can use extended partitions. An extended partition is a primary partition that has been subdivided.</NOTE>
<BR>
<HR ALIGN=CENTER>
</BLOCKQUOTE></BLOCKQUOTE>
<P>A partition table that contains the details of the partitions on the disk is written to the first sector (boot sector) of each hard disk (not each platter). This sector is sometimes called the Master Boot Record or MBR. Although the terms boot sector and MBR are often used interchangeably, MBRs differ from boot sectors in that MBRs contain partition information. In other words, you can call a hard drive's boot sectors MBRs, but floppy disks' boot sectors are never MBRs. Extended partitions also have partition tables written to their beginning sectors. A program called the map installer creates Linux boot sectors.
<BR>
<P>When a hard disk has several partitions, Linux refers to them by device numbers after the primary disk name, such as /dev/hda1, /dev/hda2, and so on. In this case, /dev/hda is the first hard drive (/dev/hdb would be the second, /dev/hdc the third, and so on). Within the first hard drive, the partitions are named /dev/hda1, /dev/hda2, and so on. A second hard disk called /dev/hdb has partitions called /dev/hdb1, /dev/hdb2, and so on. The disk names may have other letters, depending on the type of hard disk and its adapter. For example, a hard disk may be called /dev/sd1 instead of /dev/hda. Extended partitions would be numbered /dev/hda5, /dev/hda6, and so on because only four primary partitions, or /dev/hda4, are allowed.
<BR>
<BR>
<A NAME="E68E21"></A>
<H3 ALIGN=CENTER>
<CENTER>
<FONT SIZE=5 COLOR="#FF0000"><B>The Boot Sector</B></FONT></CENTER></H3>
<BR>
<P>To understand the Linux boot process, a look at the DOS boot sector is necessary. Figure 4.1 shows the DOS boot sector layout. The program code is the bootstrap to the operating system. The disk parameters include the File Allocation Table (FAT).
<BR>
<P><B> <A HREF="04LSG01.gif">Figure 4.1.</B>
<BR><B>The DOS boot sector layout.</A></B>
<BR>
<P>Linux's LILO boot sector is similar to the DOS boot sector, except that the disk parameter section is not used and the boundaries between code sections are different. The differences between the two boot sectors can cause a problem for DOS if the Linux LILO boot sector is written to a DOS disk's Master Boot Record, because DOS won't be able to load properly. Figure 4.2 shows the Linux boot sector layout. The magic number referred to in this and the previous boot sector layout is a two-byte number used by some operating systems to verify that the sector read is the boot sector.
<BR>
<P><B> <A HREF="04LSG02.gif">Figure 4.2.</B>
<BR><B>The Linux LILO boot sector layout.</A></B>
<BR>
<P>You could, in theory, use the Linux LILO boot sector to boot DOS, as the partition table area of the boot record could contain DOS' FAT, but in practice, the boot process usually fails. It is much better to use a boot sector written to the DOS partition.
<BR>
<BLOCKQUOTE>
<BLOCKQUOTE>
<HR ALIGN=CENTER>
<BR>
<NOTE>Because the DOS and Linux LILO boot sectors differ, you should install DOS before Linux. Doing so ensures that the DOS boot sector is written to the hard disk. If you install Linux first and the Linux LILO boot sector is written to the hard disk, DOS cannot boot.</NOTE>
<BR>
<HR ALIGN=CENTER>
</BLOCKQUOTE></BLOCKQUOTE>
<P>You can save the LILO boot sector on a boot floppy disk, in the Master Boot Record of the hard disk, on the boot sector of the Linux partition, or in the boot sector of an extended partition. You cannot store it in any non-Linux partition or on any hard disk other than the first. Note that although DOS cannot handle a boot sector in an extended partition, Linux can through extensions to fdisk or a utility program called activate.
<BR>
<BLOCKQUOTE>
<BLOCKQUOTE>
<HR ALIGN=CENTER>
<BR>
<NOTE>A common problem with LILO is that it will write a LILO boot sector anywhere, even into locations that the operating system cannot access. Make sure you are writing your LILO boot sector to a valid location. If you have already installed Linux and are making changes, keep a boot floppy disk at hand.</NOTE>
<BR>
<HR ALIGN=CENTER>
</BLOCKQUOTE></BLOCKQUOTE>
<BR>
<A NAME="E68E22"></A>
<H3 ALIGN=CENTER>
<CENTER>
<FONT SIZE=5 COLOR="#FF0000"><B>The Boot Process</B></FONT></CENTER></H3>
<BR>
<P>During the boot process, the boot sector is read to obtain the bootstrap for the operating system. In the case of DOS, the Master Boot record or boot sector is read, and then COMMAND.COM is loaded. COMMAND.COM is DOS' kernel.
<BR>
<P>Although usually the boot system is set up when the Linux installation process is followed, you may want to alter Linux's boot system. Depending on your requirements and machine hard drive configuration, you can take one of several approaches. The following sections look at a few of the typical configuration examples to show how you can modify the boot process. These sections begin by explaining the process to follow to install LILO manually, although you can often perform these processes automatically when installing the Linux software. This section looks at the automated installation process and its options later on. For now, though, the details of each alternative should help you decide how to install LILO on your system.
<BR>
<BR>
<A NAME="E69E47"></A>
<H4 ALIGN=CENTER>
<CENTER>
<FONT SIZE=4 COLOR="#FF0000"><B>Installing a Dedicated Linux Hard Disk</B></FONT></CENTER></H4>
<BR>
<P>With a dedicated Linux installation, or a Linux boot by default despite other operating systems on the hard disk, the Linux LILO boot sector can replace the Master Boot Record. LILO will then boot straight into Linux from the Master Boot Record without touching partition boot sectors. In some cases, though, you may have to explicitly specify the boot sector. In other words, you may have to specify boot=/dev/hda (or whichever device holds the modified master boot record) at the boot prompt if the default values do not work.
<BR>
<BLOCKQUOTE>
<BLOCKQUOTE>
<HR ALIGN=CENTER>
<BR>
<NOTE>If you replace the Master Boot Record with LILO for a dedicated Linux system then later remove Linux, you will have to low-level format the hard drive or restore the old MBR before another operating system, such as DOS, can use the drive.</NOTE>
<BR>
<HR ALIGN=CENTER>
</BLOCKQUOTE></BLOCKQUOTE>
<P>To install LILO as a dedicated Linux boot, follow these steps:
<BR>
<OL>
<LI>Boot Linux as usual. Make sure you have a boot floppy disk in case of problems.
<BR>
<BR>
<LI>Copy your existing Master Boot Record to a floppy disk in case of problems. The command to copy the MBR from the main drive (/dev/hda) to a floppy disk using 512 character blocks (the default) is
<BR>dd if=/dev/hda of=/fd/MBR bs=512 count=1
<BR>
<LI>Use the setup or LILO installation program to copy LILO into the boot sector, setting LILO in the Master Boot Record.
<BR>
<BR>
<LI>Reboot the machine to boot from the Master Boot Record.
<BR>
<BR>
</OL>
<P>Your machine should load Linux automatically. If Linux does not boot, use your boot floppy to start Linux and either repeat the process or restore the original Master Boot Record from the floppy disk using the command
<BR>
<BR>
<PRE>
<FONT COLOR="#000080">dd if=/fd/MBR of=/dev/hda bs=446 count=1</FONT></PRE>
<BR>
<A NAME="E69E48"></A>
<H4 ALIGN=CENTER>
<CENTER>
<FONT SIZE=4 COLOR="#FF0000"><B>Using BOOTACTV</B></FONT></CENTER></H4>
<BR>
<P>A slight modification of the last boot process is replacing the normal MBR with a utility called BOOTACTV, which prompts for the partition to boot from. This utility requires that a non-DOS-compatible copy of the boot sector be written, so you should use it only when Linux will be the dominant operating system and LILO is not booting the other operating systems properly.
<BR>
<P>When in place, the Master Boot Record holds a copy of BOOTACTV. When booted, BOOTACTV enables you to choose which operating system to boot. BOOTACTV can then read a boot sector from a partition to load that operating system. When the MBR holds BOOTACTV, you can't use the MBR as you normally would with other operating systems, such as DOS or OS/2. You can, though, replace BOOTACT with a normal MBR.
<BR>
<P>To install BOOTACTV, follow these steps:
<BR>
<OL>
<LI>Boot Linux as usual. Make sure you have a boot floppy disk in case of problems.
<BR>
<BR>
<LI>Copy your existing Master Boot Record to a floppy disk in case of problems. The command to copy the MBR from the main drive (/dev/hda) to a floppy disk using 512 character blocks (the default) is
<BR>dd if=/dev/hda of=/fd/MBR bs=512 count=1
<BR>
<LI>Use the setup or LILO installation program to copy LILO into the boot sector of the Linux partition (not the Master Boot Record).
<BR>
<BR>
<LI>Install BOOTACTV into the Master Boot Record. The BOOTACTV utility is usually called bootactv.bin and should be in the current directory when you install it into the MBR with the command
<BR>dd if=bootactv.bin of=/dev/hda bs=446 count=1
<BR>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?