一旦,root file system加载并挂接好了,你会看见如下面一样的一条信息:
VFS: Mounted root (ext2 filesystem) readonly
Once the system has loaded a root filesystem successfully, it tries to execute the init program (in /bin or /sbin). init reads its configuration file /etc/inittab, looks for a line designated sysinit, and executes the named script. The sysinit script is usually something like /etc/rc or /etc/init.d/boot. This script is a set of shell commands that set up basic system services, such as running fsck on hard disks, loading necessary kernel modules, initializing swapping, initializing the network, and mounting disks mentioned in /etc/fstab.
一旦系统成功加载了root file system,它会尝试执行init 程序(在/bin中,或者/sbin中)。init会读取配置文件 /etc/inittab,找寻指定为sysinit的一行,然后执行命名的脚本。sysinit脚本通常是像 /etc/rc或者 /etc/init.d/boot一样的东西。该脚本是一系列脚本命令的集合,用以建立基本的系统服务,像在硬盘上运行fsck,加载必要的kernel模块,初始化swapping,初始化网络,挂接/etc/fstab中提到的磁盘。
This script often invokes various other scripts to do modular initialization. For example, in the common SysVinit structure, the directory /etc/rc.d/ contains a complex structure of subdirectories whose files specify how to enable and shut down most system services. However, on a bootdisk the sysinit script is often very simple.
该脚本经常调用各种其他的脚本,以进行模块初始化。例如,在通常的 SysVinit结构中,目录/etc/rc.d会包含一个复杂的结构,包含很多子目录。该子目录的文件定义了怎么样开启以及关闭大部分的系统服务。然而,在启动盘上的sysinit脚本,通常是比较简单的。
When the sysinit script finishes control returns to init, which then enters the default runlevel, specified in inittab with the initdefault keyword. The runlevel line usually specifies a program like getty, which is responsible for handling commununications through the console and ttys. It is the getty program which prints the familiar “login:” prompt. The getty program in turn invokes the login program to handle login validation and to set up user sessions.
当sysinit脚本结束,控制返回到init之后,init会进入默认的runlevel,runlevel以initdefault关键字定义在inittab中。runlevel通常定义了像getty一样的程序,getty负责通过console和ttys进行通信。打印“login:”提示符,就是像getty样的程序干的事。反过来,getty调用login程序以处理login的有效性并建立用户会话。
3.2. Disk typesHaving reviewed the basic boot process, we can now define various kinds of disks involved. We classify disks into four types. The discussion here and throughout this document uses the term “disk” to refer to floppy diskettes unless otherwise specified, though most of the discussion could apply equally well to hard disks.
3.2 磁盘类型
看过了基本的启动过程之后,我们现在可以定义几种会接触到的磁盘了。我们将磁盘分为4类。这里的讨论以及贯穿整个文档,使用术语“磁盘”来提及floppy软盘,除非特别说明,虽然讨论的大部分内容也同样应用于硬盘。
bootA disk containing a kernel which can be booted. The disk can be used to boot the kernel, which then may load a root file system on another disk. The kernel on a bootdisk usually must be told where to find its root filesystem.
Often a bootdisk loads a root filesystem from another diskette, but it is possible for a bootdisk to be set up to load a hard disk’s root filesystem instead. This is commonly done when testing a new kernel (in fact, “make zdisk” will create such a bootdisk automatically from the kernel source code).
boot磁盘包含可以启动的kernel。磁盘可以用来启动kernel,之后,kernel会加载其他磁盘上的root file system。启动盘上的kernel通常都必须被告知,可以在哪里找到kernel的root file system。
经常地,启动盘会从其他的软盘加载root file system,但是对于启动盘而言,也可能替代地加载硬盘的root file system。在测试新的kernel的时候,通常会这么做(事实上,“make zdisk”就会从kernel源码自动地创建这样一个启动盘)。
rootA disk with a filesystem containing files required to run a Linux system. Such a disk does not necessarily contain either a kernel or a boot loader.
A root disk can be used to run the system independently of any other disks, once the kernel has been booted. Usually the root disk is automatically copied to a ramdisk. This makes root disk accesses much faster, and frees up the disk drive for a utility disk.
root磁盘其上有file system,并包含运行Linux系统所需的文件。这样的磁盘不必包含kernel或者boot loader。
一旦kernel已经启动起来,root磁盘可以独立于其他的磁盘运行整个系统。通常,root磁盘会被自动拷贝到ramdisk。这使得root 磁盘可以更快地访问,并且,为utility磁盘释放出了一个磁盘驱动。
boot/rootA disk which contains both the kernel and a root filesystem. In other words, it contains everything necessary to boot and run a Linux system without a hard disk. The advantage of this type of disk is that is it compact everything required is on a single disk. However, the gradually increasing size of everything means that it is increasingly difficult to fit everything on a single diskette, even with compression.
boot/root磁盘,它既包含kernel又包含root file system。换句话说,不需要硬盘,它包含启动并运行Linux系统的一切。这种类型磁盘的优势是,所必需的紧凑的所有都处在一个磁盘上。然而,即便有压缩可用,每件所需都在不断增加大小,这意味着,越来越难将所有的放在一个磁盘上。
utilityA disk which contains a filesystem, but is not intended to be mounted as a root file system. It is an additional data disk. You would use this type of disk to carry additional utilities where you have too much to fit on your root disk.
utility磁盘包含一个 file system,但并不是用于挂接作root file system。它是一个额外的数据磁盘。你会使用这种类型的磁盘搬运附加的工具,如果是在你的root磁盘上,你需要做的就太多了。
In general, when we talk about “building a bootdisk” we mean creating both the boot (kernel) and root (files) portions. They may be either together (a single boot/root disk) or separate (boot + root disks). The most flexible approach for rescue diskettes is probably to use separate boot and root diskettes, and one or more utility diskettes to handle the overflow.
一般而言,当我们谈论“构建启动盘”的时候,通常意味着,创建启动(kernel)和根(files)两部分。它们可能是在一起的(一个单一的boot/root磁盘),或者独立开的(boot + root 2个磁盘)。对于应急软盘,最灵活的方法可能是,使用独立开的boot 和 root 软盘,还有,一个或者多个utility磁盘以处理溢出的情况。
“但行好事,莫问前程”,往往成功的几率反而更大些;