System
This section describes and compares the Linux system components with Solaris OE. It includes reference tables for standard file system types, boot processes, init run levels, and system files.
This section contains the following topics:
"Partition Tables"
"Boot Loader Programs"
"Standard File Systems"
"Boot Process"
"init"
"User Environment"
"System and Log Files"
Partition Tables
On Intel machines, disks are divided into units called sectors. (1 sector = 512 bytes.) Solaris uses the term block, but the size is the same. (1 block = 512 bytes.) The first sector of the disk on an Intel machine is called the Master Boot Record (MBR). The first block of a Solaris disk is called the Volume Table of Contents (VTOC). The information contained in the two is similar. They both contain the partition table for the disk. However, the Intel MBR contains a 446-byte area at the beginning for actual boot code, whereas the first block on a Solaris disk is used only for the VTOC. What is referred to as the boot block in Solaris starts immediately after the VTOC and occupies blocks 1-15 of the disk.
The Solaris VTOC has certain tags that you can apply to a partition. These tags refer to a partition's function within Solaris, such as root, swap, or var. A disk with an fdisk label on it has tags to identify the partitions, but they usually refer to the type of operating system that resides on that partition. The tag is 1 byte in the partition table and is called the partition type. A 32-bit Windows FAT file system using LBA, an NTFS file system, and a Linux ext2 file system have partition types of 0x0c, 0x07, and 0x83 respectively. For a full list, run fdisk in Linux and type l.
Be aware that there was never a standards body or entity to assign specific values to partition types. This lack of standardization has led to some conflicts. Most notably, the conflict between a Solaris x86 partition and a Linux swap partition. Both of these have a value of 0x82. This situation becomes problematic when you want both of these operating systems to reside on the same machine. If the Linux installation program formats a Solaris x86 partition for use as swap space, the Solaris partition is completely destroyed.
Boot Loader Programs
As previously mentioned, the fdisk MBR has a 446-byte area for some boot code. On a normal Windows system, this area contains the DOS boot sector. When Linux is installed, there is an option to load a program called LInux LOader (LILO) in this area. This name is probably a misnomer because LILO can load more than just Linux. It can be configured to boot most other operating systems that you can load onto an Intel machine. There is no real parallel to LILO in Solaris. The need for LILO arose out of the fact that most Intel machines have a BIOS (PROM) that is not capable of recognizing the partition structure of a disk. BIOS cannot boot off of anything other than the MBR at the beginning of the primary disk. By comparison, OBP on SPARC machines has the ability to specify partitions and disks to boot from, as well as set hardware aliases and boot parameters, and save them to NVRAM.
A new boot loader called the GRand Unified Bootloader (GRUB) came out with RedHat Linux 7.3. The GRUB is a file-system-aware bootloader that is more feature rich than LILO. Both LILO and GRUB use configuration files that exist on a file system somewhere to identify bootable partitions and give you a command line or menu to boot them from. For LILO, the configuration file is /etc/lilo.conf. For GRUB, it's /boot/grub/grub.conf.
Standard File Systems
In Solaris, UFS is used as the predominant file system type. In Linux, it's either ext2 or the journaling version, ext3. UFS grew out of the Berkeley fast-fat file system developed for BSD UNIX by Kirk McCusick. The ext2 file system was the second version of the ext file system, which was created from scratch specifically for Linux. Even though it was created independently from UFS, most of the concepts within ext2 are the same. TABLE 6 provides comparisons between the two.
TABLE 6 Comparison of ufs and ext File System Types
Attribute |
Solaris |
Linux |
File system name |
ufs |
ext2 |
Method of journaling |
with logging mount option |
Mount as ext3 |
Default block size |
8K |
4K |
Default fragment size |
1K |
4K |
Organization |
inodes and data blocks arranged in cylinder groups |
inodes and data blocks arranged in cylinder groups |
Created with |
mkfs/newfs |
mke2fs |
Checked with |
fsck |
e2fsck |
Backed up with |
ufsdump |
dump |
Restored with |
ufsrestore |
restore |
Tuned with |
tunefs |
tune2fs |
Two tunable parameters that you might want to modify after creating an ext2 or ext3 file system are the maximal mount count and the check interval. The maximal mount count is a predetermined number of times an ext2 or ext3 file system can be mounted before a check is forced on it. The check interval is a predetermined time period before a check is forced on an ext2 or ext3 file system. This forced check happens regardless of the state of the clean flag in the superblock; that is, it ignores the fact that the file system was unmounted cleanly the last time it was used. The effect is that clean file systems get checked periodically. Because an fsck can add a lot of time to the boot process, the value of fsck might be negligible. To disable this behavior, use tune2fs -c 0 -i 0 <partition> on the partition that contains your file system.
Boot Process
Linux has a /boot directory that contains files (including the kernel itself) needed to boot. On pre-1999 Intel machines, it was necessary to have the kernel inside an 8 gigabyte boundary at the beginning of the disk. One of the ways to accomplish this configuration was by making a separate /boot file system and physically locating it at the beginning of the disk, or at least before the 8 gigabyte boundary. Because of a feature in LILO called 32-bit logical block addressing (lba32) that takes advantage of BIOS functionality found in newer machines, this configuration is no longer necessary. TABLE 7 summarizes the files used by Linux to boot.
TABLE 7 Linux Files Used to Boot a System
File |
Purpose |
boot.xxyy |
Copy of the boot sector that LILO makes the first time it runs. Used if LILO is uninstalled via lilo -u. Where xx=major number of disk and yy=minor number of disk. |
boot.b |
Second stage boot loader. Loads the chain loader, kernel, or partition boot sector of a foreign OS. |
chain.b |
Chain loader required to boot a partition that is not on the primary disk. |
map |
File created by LILO that contains the names and physical locations of all the kernels and foreign operating systems that it can boot (as defined in /etc/lilo.conf). |
vmlinuz |
Compressed kernel. |
System.map |
The text version of the kernel-symbol table generated by running /usr/bin/nm against the uncompressed kernel image during the kernel build process. The Solaris equivalent would be to run /usr/ccs/bin/nm against /dev/ksyms or unix.0 from a kernel core dump. System.map is used by some programs, such as klogd and ps, that provide more useful output with symbol names rather than with addresses. |
initrd |
Initial RAM disk. The initrd allows you to use a RAM disk as the root file system, usually temporarily. This technique gives the ability to load modules required to access a real root file system and not have to build these modules into the kernel itself. After the real root file system is mounted, the context is switched via the Linux system call pivot_root(2). |
As in Solaris, the boot process in Linux goes through several stages. TABLE 8 shows parallels between the two processes, without overly generalizing. The process outlined in this table assumes that LILO is installed in the MBR on the boot disk.
TABLE 8 Boot Process in Solaris and Linux
Solaris |
Linux |
OBP selects defined boot device and reads the boot block (sectors 1-15) of this partition. |
BIOS reads MBR and loads first-stage boot loader. |
Program read in from boot block loads secondary boot loader (ufsboot). |
First-stage boot loader finds second-stage boot loader (/boot/boot.b) and executes it. |
ufsboot finds, loads, then executes the kernel. |
/boot/boot.b reads in descriptor table from /boot/map. The map file contains the boot sector of the kernel to be loaded. The second-stage boot loader then loads the kernel. |
Kernel mounts root file system, loads modules, and starts init. |
Kernel mounts root file system, loads modules and starts init.* |
init starts the appropriate run level script(s). |
init starts /etc/rc.d/rc.sysinit, then starts the appropriate run level script. |
*If initrd is required, it is mounted before the real root file system.
init
In Linux, init works essentially the same as it does in Solaris, although the run levels and scripts are somewhat different. In Solaris, the scripts in /etc/rcS.d are always run initially, regardless of what run level the system is booting. Linux does not have a /etc/rcS.d directory, but it has a script, /etc/rc.d/rc.sysinit, that accomplishes the same purpose. The run level script directories in Linux are in /etc/rc.d, but the directories contained therein are symbolically linked to /etc, so their location is effectively the same as in Solaris. One other difference is that run level scripts in Linux are symbolically linked from /etc/init.d to the run level directories, whereas they are typically hard linked in Solaris.
One thing to note for both Solaris and Linux is the distinction between run level S and run level 1. Both operating environments handle them similarly. Run level S is more of a run level to initially boot to, rather than issue an init command to take you to it. Run level 1 is more appropriate to use if you are already at a higher run level and want to bring the machine down to a maintenance state. This is mainly because kill scripts tend to get installed in /etc/rc1.d rather than /etc/rcS.d.
To boot single-user mode in Solaris, issue a boot -s command from the ok prompt in Open Boot PROM. In Linux, boot single-user mode by issuing a boot single command from the LILO prompt or add single to the list of kernel parameters in GRUB.
If the graphical login option is chosen during the installation process, the default run level is 5. Otherwise, it is set to 3.
TABLE 9 shows the run levels for Solaris and Linux.
TABLE 9 Run Levels for Solaris and Linux
Function |
Solaris Run Level |
Linux Run Level |
Shutdown |
0 |
0* |
Single user/Maintenance mode |
S/1 |
S/1 |
Multi-user mode, no NFS |
2 |
2 |
Multi-user mode |
3 |
3 |
Multi-user mode with graphical interface |
3 |
5 |
Shutdown with power off |
5 |
0* |
Reboot |
6 |
6 |
*init 0 performs a power off in runlevel 0 if the kernel is configured for power management.
User Environment
After Linux completes the boot process, either a character terminal (runlevel 3) or graphical login screen (runlevel 5) is present. In the character-terminal environment, by default there are six virtual consoles that can be used.
The virtual consoles can be accessed by pressing Alt-F1 through Alt-F6 on a keyboard. If a graphical environment is used, the virtual consoles of the character-terminal environment can be accessed by pressing Control-Alt-F1 through Control-Alt-F6. The use of the control key is only necessary to switch from graphical mode to character-terminal mode. To switch back to graphical mode, press Alt-F7.
Two main graphical environments exist in most current versions of Linux: KDE and GNOME. The use of either is a personal preference by the user. Both are similar in functionality.
By default, the root account uses bash as its shell and /root as its home directory.
System and Log Files
Many system configuration and log files have the same names and uses in Solaris and Linux. TABLE 10 lists some that are not the same. This list is not all-inclusive. The functionality between the files listed is similar, but the syntax and structure can be different. In some cases, a directory of configuration files is used in Linux where only a single file is used in Solaris. For a more extensive list, refer to the Web site http://bhami.com/rosetta.html.
TABLE 10 Differing System and Log Files in Solaris and Linux
Solaris |
Linux |
Purpose |
/etc/dfs/dfstab |
/etc/exports |
NFS server configuration |
/etc/auto_master, /etc/auto_home |
/etc/auto.master, /etc/auto.home |
automounter configuration |
/var/spool/cron/crontabs/root |
/etc/crontab |
cron |
/etc/vfstab |
/etc/fstab |
File system table |
/etc/mnttab |
/etc/mtab |
Kernel list of currently mounted file systems |
/etc/inetd.conf |
/etc/xinetd.conf, \ /etc/xinetd.d (directory) |
Internet daemon configuration |
/etc/defaultdomain, \ /var/yp/binding/'domainname'/ypservers / |
/etc/yp.conf |
YP configuration |
/var/adm/messages |
/var/log/messages |
Sytem log file |
/etc/ftpusers (Solaris 8) \ /etc/ftpd/ftpusers (Solaris 9) |
/etc/vsftpd.ftpusers(vsftpd) \ /etc/ftpusers (wu-ftpd) |
FTP daemon user configuration (ftpusers) |
/etc/system |
/etc/sysctl.conf |
Kernel configuration |
/etc/pam.conf |
/etc/pam.d (directory) |
Pluggable Authentication Module (PAM) configuration |