INITTAB AND FSTAB FILES

INITTAB FILE - (/etc/inittab)

0 Halt

1 Single User Mode

2 Multiple user mode, without network.

3 Full Multi-user mode.

4 Not used

5 Full multi-user mode ( with an X bash )

6 Reboot.

In Red Hat Linux, there are six run levels which are given above. All the run levels are stored in the file called inittab.

[ root@localhost root]# vi /etc/inittab

#

# inittab This file describes how the INIT process should set up

# the system in a certain run-level.

#

# Author: Miquel van Smoorenburg,

# Modified for RHS Linux by Marc Ewing and Donnie Barnes

#

# Default runlevel. The runlevels used by RHS are:

# 0 - halt (Do NOT set initdefault to this)

# 1 - Single user mode

# 2 - Multiuser, without NFS (The same as 3, if you do not have networking)

# 3 - Full multiuser mode

# 4 - unused

# 5 - X11

# 6 - reboot (Do NOT set initdefault to this)

#

id:5:initdefault:

# System initialization.

si::sysinit:/etc/rc.d/rc.sysinit

l0:0:wait:/etc/rc.d/rc 0

l1:1:wait:/etc/rc.d/rc 1

l2:2:wait:/etc/rc.d/rc 2

l3:3:wait:/etc/rc.d/rc 3

l4:4:wait:/etc/rc.d/rc 4

l5:5:wait:/etc/rc.d/rc 5

l6:6:wait:/etc/rc.d/rc 6

# Trap CTRL-ALT-DELETE

ca::ctrlaltdel:/sbin/shutdown -t3 -r now

# When our UPS tells us power has failed, assume we have a few minutes

# of power left. Schedule a shutdown for 2 minutes from now.

# This does, of course, assume you have powerd installed and your

# UPS connected and working correctly.

pf::powerfail:/sbin/shutdown -f -h +2 "Power Failure; System Shutting Down"

# If power was restored before the shutdown kicked in, cancel it.

pr:12345:powerokwait:/sbin/shutdown -c "Power Restored; Shutdown Cancelled"

# Run gettys in standard runlevels

1:2345:respawn:/sbin/mingetty tty1

2:2345:respawn:/sbin/mingetty tty2

3:2345:respawn:/sbin/mingetty tty3

4:2345:respawn:/sbin/mingetty tty4

5:2345:respawn:/sbin/mingetty tty5

6:2345:respawn:/sbin/mingetty tty6

# Run xdm in runlevel 5

x:5:respawn:/etc/X11/prefdm -nodaemon

ð In the file there are some important lines which are given below;

id:3:initdefault:

ð 3 is run level. initdefault is meant a default value is 3. If you make empty of second field, then Red Hat booting will stop and ask a run level type to you.

si:sysinit:/etc/rc.d/rc.sysinit

ð After starting the first line, this line, means sysinit will start. All the information is stored in the file called

[ root@localhost root]# vi /etc/rc.d/rc.sysinit

ð This file is a script file and it one of most important file. So, don't edit this file,

10:0:wait:/etc/rc.d/rc 0

11:0:wait:/etc/rc.d/rc 1

12:2:wait:/etc/rc.d/rc 2

13:3:wait:/etc/rc.d/rc 3

14:4:wait:/etc/rc.d/rc 4

15:5:wait:/etc/rc.d/rc 5

16:6:wait:/etc/rc.d/rc 6

ð All this lines are important for init. There are some important directory called, /etc/rc.d, in this directory there are some sub directory, rc0.d, rc1.d, rc2.d, rc3.d, rc04d, rc0.5 and rc6.d.

[ root@localhost root]# ls /etc/rc.d/rc3.d

ð Show all the files in the directory. Hare some file's name will start from "K" or "S". "K" means kill the file and "S" means start the file. The S script is run in the numerical order listed in their filenames. Other, rc0.d, rc1.d, ... ... .. directories file also start from same name style.

ud::once:/sbin/update

ð This line will run for even run levels.

ca::ctrlaltdel:/sbin/shutdown -t3 -r now

ð When will you press CTRL+ALT+DELETE then it will execute the command (shutdown -t3 -r now).

pf::powerfail:/sbin/shutdown -f -h +2 "Power Failure ; System shutting down"

ð UPS informs to us that UPS power has failed through this message showing on the monitor screen.

pr:12345:powerokwait:/sbin/shutdown -c "Power Restored; Shutdown Cancelled"

ð If power is restored before the shutdown reasoned by UPS low power supply, then shutdown will be canceled and sent the message on the monitor screen.

1:2345:respawn:/sbin/mingtty tty1

2:2345:respawn:/sbin/mingtty tty2

3:2345:respawn:/sbin/mingtty tty3

4:2345:respawn:/sbin/mingtty tty4

5:2345:respawn:/sbin/mingtty tty5

6:2345:respawn:/sbin/mingtty tty6

ð All lines used for users’ terminal. The first column shows terminal number; second column mentions which init will be supported by the terminal; the fourth column is the name of first application which will start on terminal (/sbin/mingtty is the login page); the fifth column is the terminal name. We can also create many terminals by adding more line and mentioning the terminal number. Example,

7:2345:respawn:/sbin/mingtty tty7

8:2345:respawn:/sbin/mingtty tty15

... ... ... .. ... ... ... ...

... ... ... ... ... ... ... ...

But, there is a question, how shell we open the 15th terminal? Yes, there is a command, chvt means changing virtual terminal. syntax,

chvt <>

[ root@localhost root]# chvt 15 [Here 15 means tty15]

ð Then we get a login screen of terminal 15.

X:5:respawn:/etc/X11/prefdm -nodaemon

ð This line used for graphic mode. There are two files used for graphic mode, called:

[ root@localhost root]# vi /etc/X11/prefdm

[ root@localhost root]# vi /etc/sysconfig/desktop

ð Here, first is the script file, and second file is database file, from this file, information (example, KDA, GENOM etc) can be sent to prefdm file.

There is an important command, init to go from one init mode to another. Example,

[ root@localhost root]# init 0

ð Kernel will kill all running processes and system will be halt.

[ root@localhost root]# init 1

ð Linux will be opened as single user mode.

[ root@localhost root]# init 2

ð Linux will be opened as multi user mode but nobody can’t operate network.

[ root@localhost root]# init 3

ð Linux will be opened as multi user mode with network support but it does not support graphical mode.

[ root@localhost root]# init 5

ð Linux will be opened as multi user mode with network and graphical support.

[ root@localhost root]# init 6

ð Kernel will restart the system.

To know under which init mode the system is running we can use a command, runlevel.

[ root@localhost root]# runlevel

ð It displays the current run level (or init mode).

FSTAB FILE – (/etc/fstab)


fstab contains important information about your file systems, such as what file system type of the partition are, where they are located on the hard drive and what is the mount point used to access them.

[ root@localhost root]# vi /etc/fstab

LABEL=/ / ext3 defaults 1 1

LABEL=/boot /boot ext3 defaults 1 2

none /dev/pts devpts gid=5,mode=620 0 0

none /dev/shm tmpfs defaults 0 0

none /proc proc defaults 0 0

none /sys sysfs defaults 0 0

/dev/hda9 swap swap defaults 0 0

/dev/cdrom /mnt/cdrom udf,iso9660 noauto,owner,kudzu,ro 0 0

/dev/cdrom1 /mnt/cdrom1 udf,iso9660 noauto,owner,kudzu,ro 0 0

/dev/fd0 /mnt/floppy auto noauto,owner,kudzu 0 0

If any wrong changes are happened in this file, then we get some problem at the boot time. This problem is given below with troubleshooting.

] give the root password for maintains

] (or type control + D to continue ):

] ( repair filesystem )1 # df

] ( repair filesystem )1 # mount -o remount,rw <> [Ex. /dev/hda1]

] ( repair filesystem )1 # vi /etc/fstab [Edit the file, if you remark any error in the file.]

] ( repair filesystem )1 # init 3