The system initialization script runs first. On a Red Hat system, this is a single script named /etc/ rc.d/rc.sysinit. Other Linux distributions might use a different filename, but all versions of Linux use script files to initialize the system. The rc.sysinit script performs many essential system initialization tasks, such as preparing the network and the filesystems for use.
The rc.sysinit script begins the network initialization by reading the /etc/sysconfig/network file, which contains several network configuration values set during the initial installation. If the file is not found, networking is disabled. If it is found, the script assigns the system the hostname stored there.
The initialization script performs many small but important tasks, such as setting the system clock, applying any keyboard maps, and starting USB and PnP support. The bulk of the script, however, is used to prepare the filesystem for use. The script activates the swap file, which is necessary before the swap space is used. The rc.sysinit script also runs the filesystem check, using the fsck command to check the structure and integrity of the Linux filesystems. If a filesystem error is encountered that fsck cannot simply repair, the boot process stops, and the system reboots in single-user mode. You then must run fsck manually, and repair the disk problems yourself. When you finish the repairs, exit the single-user shell. The system will then attempt to restart the interrupted boot process from where it left off.
The initialization script mounts the /proc filesystem and, after the fsck completes, mounts the root filesystem as read-write. Recall that the root filesystem was initially mounted as read-only. The root must be remounted as read-write before the system can be used. The script also mounts other local filesystems listed in the /etc/fstab file. (The fstab file is described in Chapter 9, "File Sharing.") The rc.sysinit script finishes up by loading the loadable kernel modules.
Other initialization scripts may look different from Red Hat's, but they perform very similar functions. The order may be different, but the major functions are the same: initialize the swap file, and check and mount the local filesystems.
Was this article helpful?