lsg04.htm

来自「linux-unix130.linux.and.unix.ebooks130 l」· HTM 代码 · 共 3,109 行 · 第 1/5 页

HTM
3,109 行
字号




<BR>







<LI>The ro parameter mounts the root filesystem as read-only.







<BR>







<BR>







<LI>The rw parameter mounts the root filesystem as read-write.







<BR>







<BR>







<LI>The single parameter boots the Linux system into single-user (system administrator) mode.







<BR>







<BR>







</UL>







<P>As mentioned in the preceding list, you can use a hexadecimal device number in the root parameter. The device numbers are assigned depending on the type of device. For floppy disk drives, the numbers are assigned starting with 200: /dev/fd0 is 200, /dev/fd1 is 201, /dev/fd2 is 202, and so on. Hard disks have numbers assigned depending on the type of device. For most hard disks, the numbers start at 301 (not 300 because there is no /dev/hd0): /dev/hda1 is 301, /dev/hda2 is 302, and so on. When a second hard drive is used, the numbers jump to 340: /dev/hdb1 is 341, /dev/hdb2 is 342, and so on. For /dev/sda devices, numbering starts at 801: /dev/sda1 is 801, /dev/sda2 is 802, and so on. The second hard drive starts at 811: /dev/sdb1 is 811, /dev/sdb2 is 812, and so on. Because floppy disk and hard disk drives are usually the only devices that can act as a boot devices, these numbers should suffice for all occurrences except removable media.







<BR>







<P>You can combine parameters if you separate them with a space. At the boot prompt, the line







<BR>







<BR>







<PRE>







<FONT COLOR="#000080">image5 root=/dev/hda2 single ro</FONT></PRE>







<P>will boot the kernel called image5 located on the device /dev/hda2, for example. The filesystem will be mounted as a read-only device, and single-user mode will be invoked.







<BR>







<BR>







<A NAME="E68E23"></A>







<H3 ALIGN=CENTER>







<CENTER>







<FONT SIZE=5 COLOR="#FF0000"><B>The Map Installer</B></FONT></CENTER></H3>







<BR>







<P>The map installer is the program that updates the boot sector and creates the map file. The map installer is usually the file /etc/lilo/lilo. Whenever the map installer is running, it checks for errors in the boot sector. If an error is detected, no changes to the boot sector are written, and the installer terminates.







<BR>







<P>When a boot sector is successfully updated by the map installer, the old boot sector contents are copied into the directory /etc/lilo with the name boot.hex_num where hex_num is the hexadecimal device number of the partition that was rewritten. The hexadecimal device numbers were mentioned in the previous section. When the map installer writes to a partition's boot sector, the old copy of the boot sector is stored in a file with the name part.hex_num. Again, hex_num is the number of the device.







<BR>







<P>You can modify the map installer's behavior by supplying command line parameters when the installer is invoked or by making entries in the configuration file /etc/lilo/config. On later versions of Linux, including the version supplied on the CD-ROM with this book, the file is /etc/lilo.conf. A sample /etc/lilo.conf looks like the following:







<BR>







<PRE>







<FONT COLOR="#000080"># LILO configuration file







# generated by 'liloconfig'







#







# Start LILO global section







boot = /dev/fd0







#compact # faster, but won't work on all systems.







delay = 50







vga = normal # force sane state







ramdisk = 0 # paranoia setting







# End LILO global section







# Linux bootable partition config begins







image = /vmlinuz







 root = /dev/sda3







 label = Linux







 read-only # Non-UMSDOS filesystems should be mounted read-only for checking







# Linux bootable partition config ends







# DOS bootable partition config begins







other = /dev/sda1







 label = DOS







 table = /dev/sda







# DOS bootable partition config ends</FONT></PRE>







<P>As you can see, this lilo.conf file uses a boot floppy disk to hold the LILO image (/dev/fd0) and avoids overwriting the MBR or superblock of a partition. The Linux partition is /dev/sda3 and is called Linux. A DOS partition, /dev/sda1, called DOS also exists on the hard drive. You can use many of the available options from either the LILO command line or the configuration file. The following sections discuss the configuration options.







<BR>







<BR>







<A NAME="E69E53"></A>







<H4 ALIGN=CENTER>







<CENTER>







<FONT SIZE=4 COLOR="#FF0000"><B>Map Installer Command-Line Options</B></FONT></CENTER></H4>







<BR>







<P>The LILO map installer utility accepts a number of options on the command line. Many of the command-line options are mirrored by configuration variables, discussed in the next section. The following list describes the command-line options:







<BR>







<UL>







<LI>The -b <I>dev</I> option uses dev as the boot device. If no value is specified, the default device given by the boot configuration variable is used.







<BR>







<BR>







<LI>The -c option turns on compact, merging read requests for adjacent sectors into one request to reduce load time. This option is often used for boot floppy disks. You also can use the compact configuration variable to specify this option.







<BR>







<BR>







<LI>The -C <I>file</I> option uses <I>file</I> as the configuration file. If no file is specified, /etc/lilo/config is used as the default.







<BR>







<BR>







<LI>The -d <I>secs</I> option specifies the number of tenths of a second to wait before booting the first image. You also can specify this number in the configuration variable delay.







<BR>







<BR>







<LI>The -f <I>file</I> option uses <I>file</I> as the name of the disk parameter table (called disktab). If a filename is omitted, the file /etc/lilo/disktab is used.







<BR>







<BR>







<LI>The -i <I>sector</I> option installs the kernel as the new boot sector. The argument to be used with this option can be read from the install configuration variable.







<BR>







<BR>







<LI>The -I <I>name</I> option displays the path of the named kernel image file. If no matching name is found, an error is generated. You can add the v option after the name to verify the existence of the image file. This option uses the BOOT_IMAGE environment variable.







<BR>







<BR>







<LI>The -l option generates linear sector addresses instead of the default sector/head/cylinder addresses. You also can specify this option with the configuration variable linear.







<BR>







<BR>







<LI>The -m <I>file</I> option uses <I>file</I> as the location of the map file. If no filename is given, /etc/lilo/map is used.







<BR>







<BR>







<LI>The -P fix option allows LILO to adjust sector/head/cylinder addresses using the table file. You also can specify this option with the fix-table configuration variable.







<BR>







<BR>







<LI>The -P ignore option overrides correction of sector/head/cylinder addresses. You also can specify this option with the ignore-table configuration variable.







<BR>







<BR>







<LI>The -q option displays the currently mapped files.







<BR>







<BR>







<LI>The -r <I>dir</I> option performs a chroot command on <I>dir</I> before continuing. This option is necessary if the root filesystem is mounted in a different location from the map installer command. Because the current directory is changed with this command, use absolute pathnames for all files.







<BR>







<BR>







<LI>The -R <I>words</I> option stores words in the map file for use by the boot loader. The <I>words</I> are parameters that the boot process uses as part of the default command line. The first word must be the name of the boot image.







<BR>







<BR>







<LI>The -s <I>file</I> option copies the original boot sector to <I>file</I> instead of /etc/lilo/boot.hex_num.







<BR>







<BR>







<LI>The -S <I>file</I> option is the same as -s, but it overwrites the old file if one exists.







<BR>







<BR>







<LI>The -t option performs a test by executing the entire installation process except writing the map file and boot sector. Ideally, you use this option with the -v option to verify accurate behavior of the map installer.







<BR>







<BR>







<LI>The -u <I>dev</I> option restores the backup copy of the boot sector for <I>dev</I>. If no device is specified, the default value is used. If the default is not a valid value, the current root device is used. The backup copy is checked for a time stamp before the write is completed.







<BR>







<BR>







<LI>The -U <I>dev</I> option is the same as -u except that it doesn't check for the time stamp.







<BR>







<BR>







<LI>The -v <I>level</I> option uses the verbose output level specified to display messages.







<BR>







<BR>







<LI>The -V option displays the version number of the map installer, and then exits.







<BR>







<BR>







</UL>







<BR>







<A NAME="E69E54"></A>







<H4 ALIGN=CENTER>







<CENTER>







<FONT SIZE=4 COLOR="#FF0000"><B>Map Installer Configuration File Options</B></FONT></CENTER></H4>







<BR>







<P>You can store configuration options for the map installer in the file /etc/lilo/config or /etc/lilo.conf (depending on the version of Linux). The file consists of sets of parameter-value pairs, although some options do not need a value. You can use whitespace between the parameter and the equal sign and between the equal sign and the value. You can include comments by starting the line with a pound sign. A new line character terminates the comment. As a rule, variable names are case insensitive, while values are usually case sensitive. It is good practice, though, to keep all entries lowercase (as is UNIX convention).







<BR>







<P>You can put the following options into the map installer configuration file /etc/lilo/config or /etc/lilo.conf:







<BR>







<UL>







<LI>The alias=<I>name</I> option allows an image to be called by the string name as well as its normal filename.







<BR>







<BR>







<LI>The append=<I>string</I> option appends <I>string</I> to the command line passed to the kernel. This option is mostly used to pass boot parameters for hardware devices that are not automatically detected by the kernel.







<BR>







<BR>







<LI>The backup=<I>file</I> option copies the original boot sector to <I>file</I> instead of /etc/lilo/boot.hex_num. You also can specify a device (like /dev/null) instead of a file.







<BR>







<BR>







<LI>The boot=<I>dev</I> option specifies the device that contains the boot sector. If no name is specified, the currently mounted root partition is used.







<BR>







<BR>







<LI>The compact option merges read requests for adjacent sectors into a single read request, reducing the load time and file size. This option is commonly used with floppy disks.







<BR>







<BR>







⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?