Logical Volume Manager.docx

  • Uploaded by: keshav
  • 0
  • 0
  • May 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Logical Volume Manager.docx as PDF for free.

More details

  • Words: 15,908
  • Pages: 85
Logical Volume Manager:-The set of operating system commands, and other tools that allow us to establish and control logical volume storage is called the Logical Volume Manager (LVM). Also Managing large hard disk farms by letting us add disks, replace disks, copy and share contents from one disk to another without disrupting service (hot swapping).

Logical volume storage concepts:The five basic logical storage concepts are: Physical volumes, physical partitions, logical volumes, logical partitions and volume groups.

      

Each individual fixed-disk drive is called a physical volume (PV). All physical volumes belong to one volume group (VG) named rootvg. All of the physical volumes in a volume group are divided into physical partitions (PPs) of the same size. Within each volume group, one or more logical volumes (LVs) are defined. Logical volumes are groups of information located on physical volumes. Each logical volume consists of one or more logical partitions (LPs). Each logical partition corresponds to at least one physical partition.

AIX(Advanced Interactive eXecutive)

Q: – Explain the AIX file system. – AIX uses a hierarchical file tree that consists of directories, subdirectories and files. – The top level directory is called the root (/) directory that has many subdirectories. – The file tree is mounted during the system startup.

Q: – What are the keyboard shortcuts used on AIX terminal ? – Backspace : to correct mistakes. – : terminates the correct command and return to the shell. – : end of transmission or end of file – : temporary stops the output to the screen – : resumes output which was stopped by ctrl+s – : erases the entire line.

Bash is the shell, or command language interpreter, for the GNU operating system. The name is an acronym for the 'Bourne-Again SHell', a pun on Stephen Bourne, the author of the direct ancestor of the current Unix shell sh, which appeared in the Seventh Edition Bell Labs Research version of Unix.

AIX QUESTIONS: 1.How do I know if my volume group is normal, big, or scalable ? Run the lsvg command on the volume group and look at the value for MAX physical volume (PVs). The value is 32 for normal, 128 for big and 1,024 for scalable volume group. 2.How do I create a volume group? Use the following command, where s partition_size sets the number of megabytes (MB) in each physical partition where the partition_size is expressed in units of MB from one through 1,024. (It’s one through 131,072 for AIX 5.3.) mkvg -y name_of_volume_group -s partition_size list_of_hard_disks

The partition_size variable must be equal to a power of two (for example: one, two, four or eight). The default value for standard and big volume groups is the lowest value to remain within the limitation of 1,016 physical partitions per physical volume. The default value for scalable volume groups is the lowest value to accommodate 2,040 physical partitions per physical volume. 3.How can I change the characteristics of a volume group? You use the chvg command to change the characteristics of a volume group.

4.How do I create a logical volume? mklv -y name_of_logical_volume name_of_volume_group number_of_partition

5.How do I increase the size of a logical volume? To increase the size of the logical volume represented by the lv05 directory by three logical partitions, for example, type extendlv lv05 3.

6.How do I display all logical volumes that are part of a volume group (e,g, rootvg)? You can display all logical volumes that are part of rootvg by typing the following command: #lsvg -l rootvg/

7.How do I list information about logical volumes? Run the following command to display information about the logical volume

#lv1: lslv lv1. 8.How can I clone the rootvg? You can run the alt_disk_copy command to copy the current rootvg to an alternate disk. The following example shows how to clone the rootvg to hdisk1: alt_disk_copy d hdisk1.] 9.How do I replace a disk? extendvg VolumeGroupName hdisk_new migratepv hdisk_bad hdisk_new reducevg -d VolumeGroupName hdisk_bad 10.How do I mirror a logical volume? mklvcopy LogicalVolumeName Numberofcopies syncvg VolumeGroupName 11.How can I display or set values for network parameters? The no command sets or displays current or next boot values for network tuning parameters 12.How do I get the IP address of my machine? Type one of the following: ifconfig -a or host Fully_Qualified_Host_Name. For example, host cyclop.austin.ibm.com. 13.How do I identify the network interfaces on my server? Either of the following two commands will display the network interfaces: lsdev -Cc if or ifconfig -a. To get information about one specific network interface, for eaxample tr0, run the command ifconfig tr0. 14.How do I activate a network interface? To activate the network interface tr0, run the command ifconfig tr0 up. 15.How do I display routing table, interface and protocol information? To display routing table information for an Internet interface, type netstat -r -f inet. To display interface information for an Internet interface, type netstat -i -f inet. To display statistics for each protocol, type netstat -s -f inet. 16.How will you create a file if a disk is given to you? #mkvg –y datavg –s 128 hdisk1 (pv name) #mklv -y datalv –t jfs2 datavg 1 #crfs –v jfs2 –d datalv –g datavg –a size=10M –m /fs1 17.Difference between JFS & JFS2? JFS: JFS is normal filesystem. We cannot create large files in JFS. Files can be access dynamically. Max file system size=1TB

Max file size=64GB Inode size=128b JFS2:Can create a large size filesystems. Files can be access accordingly as required. (not randomly or sequentially) Max files system size=4PB Max file size=4PB Inode size=512 18.How will you find the inode number? # ls –li # istat /etc/passwd 19.How will you find LTG size? #lsvg vgname #lquerypv –M hdiskname 20.How will you change LTG size? #rmdev -l hdiskx #chdev -l hdiskx -a max_transfer=0*80000 #mkdev -l hdiskx 21.How will you find whether a quorum is up or not? # lsvg vg name 22.How to copy a LV from one VG to another? # cplv -v <sourcelvname> 23.Mirroring concept? Check disk size belong to vg , take two same size disk to mirror # bootinfo –s hdisk2 #lsvg –p rootvg Add one more disk of same size of already have disk having rootvg. # extendvg rootvg hdisk2 # lsvg –p rootvg Now mirror vg with background sync LV. It sync LVs in background with new LVs # mirrorvg –s rootvg Create a boot image # bosboot –ad /dev/hdisk2 #bosboot –ad /dev/hdisk1 Add a blv record of newly added disk, first check and then add. # bootlist –m normal -o #bootlist –m normal hdisk2 hdisk1 24.How will you unmirror a VG if a PV gets failed?

First check the blv record using, # bootlist –m normal –o Remove the old blv record, using # chpv –c hdisk2 # bootlist –m normal hdisk1 # bootlist –m normal hdisk2 Now unmirrorvg # unmirrorvg rootvg hdisk2 # reducevg rootvg hdisk2 #lsvg –p rootvg # lspv # bootlist –m normal –o 25.How will you change a PP size? PP size can be changed using a T-factor. If not then add a partitions in VG by adding one disk. # chvg –t3 rootvg 26.T – Factor? T – factor means that it will change the pp size to increase the efficiency of vg #chvg –t16 datavg Cal-if suppose that datavg pp size is 1016 we can take t factor is 16 then it comes to 2048 and pv contains in vg is 2. 27. What is the default PP Size in AIX? 128MB 28.How will you rename a VG? Unmount all filesystems in VG. # umount /test (mount point name) #varyoffvg datavg #exportvg datavg0 Importvg with new name # importvg –y newvg hdisk4 29.What is major number? A major number refers to a type of device. A device number is a major number, and a minor number specifies a particular device of that type or sometimes the operation mode of that device type. 30.What will you do if a disk gets failed? diag command

31. How to enable & disable quorum? # chvg –vy pv_name # chvg –vn pv_name #chvg –Qn vgname #chvg –Qs vgname 32.What are the types of error? 1.H/W error 2. S/W error 3. Operator error 4. Unknown error. 33.What are the error levels severity? 1. permanent 2. Temporary 3. Informational 4. Unknown. 34.What is the command to see the error log? # errpt –a # errpt –d H [H/W] # errpt –d S [S/W] 35.What is the command to clear the errorlog? # errclear 36.What is the command to increase the size of error log when it is ful? #usr/lib/errdemon –s ____ [ size ] 37.What is the command to start , stop, restart and list a demon? # startsrc –g [ Demon name ] # stopsrc [Demon name ] # refrest [Demon name ] # lssrc –al 38.When does error demon start in boot process? rc.boot phase 3 39.Which file that error daemon stay? /usr/lib/errdemon 40.Two states of device availability and explain them? Available state and defined state. When device is in defined state it means it cannot use. Not in ready state. Run cfgmgr try to make available known in the system that device. Available state means that device is ready to use # lsdev –Cc disk It displays which disks are available 41.How will you check whether a device is installed or not? # lsdev –Cc disk

42.How to change a 64 bit kernel to 32 bit kernel? 1. Modify the /usr/lib/boot/unix directory and the /unix directory to be a symbolic link to the binary for the desired kernel. 2. Run the bosboot command to write a new system boot image. 3. Reboot the system. The path name of the 64-bit kernel is /usr/lib/boot/unix_64, and the path name of the multiprocessor versions of the 32-bit kernel is /usr/lib/boot/unix_mp. # ln -sf /usr/lib/boot/unix_mp /unix # ln -sf /usr/lib/boot/unix_mp /usr/lib/boot/unix # lslv -m hd5 # bosboot -ad /dev/ipldevice # shutdown -Fr # bootinfo -K (should now be 32) 43.How to change a 32 bit kernel to 64 bit kernel? To truly change the kernel to 64-bit from 32-bit, the system must be at the AIX® 5.1 or AIX 5.2levels. # bootinfo –y It shows a kernel is either 32-bit or 64-bit. To truly change the kernel to 64-bit from 32-bit, the system must be at the AIX® 5.1 or AIX 5.2levels. # bootinfo –y It shows a kernel is either 32-bit or 64-bit. To change to a 64-bit kernel, enter the following commands: # ln -sf /usr/lib/boot/unix_64 /unix # ln -sf /usr/lib/boot/unix_64 /usr/lib/boot/unix # lslv -m hd5 # bosboot -ad /dev/ipldevice # shutdown -Fr 44. How many VGs can be created in a LVM? 255 any no. of vg can create. 45.Types of VG & explain about them? Normal vg -32 pv, 256 lv # mkvg –y normvg –s 128 hdisk4 Big vg :- 128pv,512lv # mkvg -B –y bigvg –s 128 hdisk9

Scalable vg: -1024pv, 4096 lv # mkvg –S –y scalvg –s 512 hdisk1 46. How to convert a normal VG to big & scalable VG and also Big to Scalable VG? #chvg –B vgname /big vg # chvg –S/-G vgname /scale vg 47.What is VGDA, VGSA? VGDA: Volume Group Descriptor Area. It contains the information about volume group to which the physical volume belongs to. It also contains the information about physical partitions, logical partitions and logical volumes. VGSA: Volume Group Status Area it contains the information about physical partition from all physical volumes of the same volume group. It contains the status of VG 48.Default dump device? hd6 49.Default secondary dump device? /dev/sysdumpdevnull 50.How find a system dump? #sysdumpdev -L 51.Where the file does the paging space stay? /etc/swapspaces 52.How will check whether a fix is installed or not? # instfix –ik ptfname 53.What are the two states of installation? Applied and commit state In applied state if want to do any changes on installed software then we can do But in commit the changes are not allowed to do. Once did installation. A committed fileset update cannot be rejected. Output from the installp -s command, which is used to get a list of applied software fileset updates and updates that are available to be either committed or rejected. 54.How will you reject a committed fileset? # installp –r –g fileset name 55.How will you check whether service pack is installed or not? # oslevel –s 56.What is the latest OS level? #oslevel -rq 57.How will you check whether software is installed or not? # lslpp -L |grep -i (software_name) 58.How do you find history of a file set? #lslpp –h

59.How to remove a failed package installation? #installp -C 60.How do remove the entries of the device in the odm? #rmdev -dl 61.What are the types of ODM Database ? Pre-defined database PdDv, PdAt Customised database CuDv, CuAt 62.ODM Commands. odmcreate: To customize Odm To remove ODM: odmdrop odmdelete: To remove object from ODM To see info in ODM odmget To change the fields in object class odmchange To add object to ODM odmadd 63. Types of Installation? New and complete overwrite Migration Preservation 64.Where does log files resides? AIX logs messages as specified in /etc/syslog.conf file. 65.How to unlock user account? chuser –a account=true username 66. How to lock a user’s account? #chuser account_lock=true username 67.How do u take backup of file systems? #backup -f /dev/rmt0 68.How will u restore a file from already take backup using backup? #restore -xvqf /dev/rmt0 69.How will u append a file to a previous archive take by Tar? #tar -rvf /dev/rmt0 70.What command to take backup other vg’s? # savevg –if /dev/rmt0 /vgname 71.What command to restore backup of non – rootvg? # restvg –x –d –f /dev/rmt0

Questions: PART 2 1.What are LVM1 and LVM2? 2.What is the maximum size of a single LV? 3.List of important LVM related files and Directories? 4.What is the steps to create LVM in Linux? 5.How to extend a File system in Linux? 6.How to reduce the File system size in Linux? 7.How to add new LUN from storage to Linux server? 8.How to resize root file system on RHEL 6? 9.How to find server is configured with LVM RAID ? 10.How to check Linux server is configured with power path disks? 11.How to check server is configured with Multipath disks??

Answers: 1.What are LVM1 and LVM2?

LVM1 and LVM2 are the versions of LVM. LVM1 was included in the 2.4 kernel version. LVM2 was included in the 2.6 kernel version and uses device mapper driver. 2.What is the maximum size of a single LV, logical volume? For 2.4 based kernels, the maximum LV size is 2TB. For 32-bit CPUs on 2.6 kernels, the maximum LV size is 16TB. For 64-bit CPUs on 2.6 kernels, the maximum LV size is 8EB(Exabyte). 3.List of important LVM related files and Directories? ## Directories /etc/lvm /etc/lvm/backup /etc/lvm/cache /etc/lvm/archive /var/lock/lvm # Files /etc/lvm/lvm.conf $HOME/.lvm

- default lvm directory location - where the automatic backups go - persistent filter cache - where automatic archives go after a volume group change - lock files to prevent metadata corruption

- main lvm configuration file - lvm history

4.What is the steps to create LVM in Linux? Also use url (https://linuxconfig.org/linux-lvm-logical-volume-manager)

Create a physical volume by using “pvcreate” command consider the disk is local.o #fdisk -l #fdisk /dev/sda Press "n" to create new partition. And mention the size / allocate whole disk to single partition. and assign the partition number also. #press "t" to change the partition as LVM partition. #enter "8e" ( 8e - is Hex decimal code for LVM ) #Enter "w" to write tghe information on Disk. #fdisk -l ( Now we will get newly created disk numbers) #pvcreate /dev/sda2 Add physical volume to volume group by “vgcreate” command #vgcreate VLG0 /dev/sda2 Create logical volume from volume group by “lvcreate” command. #lvcreate -L 1G -n LVM1 VLG0 Now create file system on /dev/sda2 partition by “mke2fs” or "mkfs.ext3" command. #mke2fs -j /dev/VG0/LVM1 or #mkfs.ext3 /dev/VLG0/LVM1 How to mount this as file system #mkdir /test #mount /dev/VG0/LVM1 /test

5.How to extend a File system in Linux? Check the free space on vg #vgdisplay -v VG1 Now extend the FS # lvextend -L+1G /dev/VG1/lvol1 # resize2fs /dev/VG1/lvol1

6.How to reduce the File system size in Linux? 1.First we need to reduce the file system size using "resize2fs" 2.Then reduce the lvol size using "lvreduce" #resize2fs -f /dev/VolGroup00/LogVol00 3G #lvreduce -L 5G /dev/VG1/Lvol1

7.How to add new logical unit number (LUN) from storage to Linux server? Step 1: Get the list of HBA and exisiting disk details. #ls /sys/class/fc_host #fdisk -l 2>/dev/null | egrep '^Disk' | egrep -v 'dm-' | wc -l Step 2: Scan the HBA ports (Need to scan all HBA port) #echo "1" > /sys/class/fc_host/host??/issue_lip # echo "- - -" > /sys/class/scsi_host/host??/scan Do this above steps for all HBA cards Step3 : Check the newly added Lun # cat /proc/scsi/scsi | egrep -i 'Host:' | wc -l # fdisk -l 2>/dev/null | egrep '^Disk' | egrep -v 'dm-' | wc -l

Once found the disk then do below steps to add to VolumeGroup #pvcreate /dev/diskpath #vgextend /dev/vg1 /dev/diskpath #vgs or #vgdisplay /dev/vg1

8.How to resize root file system on RHEL 6? Here is the list of steps to reduce the root file system (lv_root) on a RHEL 6 Linux server: Boot the system into rescue mode. Do not mount the file systems (select the option to 'Skip' in the rescue mode and start a shell) Bring the Volume Group online #lvm vgchange -a -y Run fsck on the FS #e2fsck -f /dev/vg_myhost/lv_root Resize the file system with new size #resize2fs -f /dev/vg00/lv_root 20G Reduce the Logical Volume of the FS with the new size #lvreduce –L 20G /dev/vg00/lv_root Run fsck to make sure the FS is still ok #e2fsck -f /dev/vg00/lv_root Optionally mount the file system in the rescue mode #mkdir -p /mnt/sysimage/root #mount -t ext4 /dev/mapper/vg00-lv_root /mnt/sysimage/root #cd /mnt/sysimage/root Unmount the FS

#cd #umount /mnt/sysimage/root Exit rescue mode and boot the system from the hard disk #exit Select the reboot option from the recue mode

9.How to check Linux server is configured with LVM RAID ? 1.How to check linux LVM RAID ? check the RAID status in /proc/mdstat #cat /proc/mdstat or # mdadm --detail /dev/mdx or # lsraid -a /dev/mdx 2.Check the Volume group disks #vgdisplay -v vg01 In disk we will get the device names like /dev/md1 , /dev/md2 . It means LVM RAID disks are configured and its added to Volume Group.

10.How to check Linux server is configured with power path disks? 1.Check power path is installed on server? #rpm –qa |grep -i emc 2.Check the power path status on server? #/etc/init.d/PowerPath status #chkconfig --list PowerPath # lsmod |grep -i emc 3.Check the Volume group disks #vgdisplay -v vg01 In disk we will get the device names like /dev/emcpowera , /dev/emcpowerb . It means powerpath disks are configured and its added to Volume Group. 4.Check the power path disk status using below command #powermt display dev=all

11.How to check server is configured with Multipath disks?? # ls -lrt /dev/mapper //To View the Mapper disk paths and Lvols #dmsetup table #dmsetup ls #dmsetup status

2.Using Multipathd Command ( Daemon )

#echo 'show paths' |multipathd -k #echo 'show maps' |multipathd –k

3.Check multipath Daemon is running or not #ps -eaf |grep -i multipathd

4.check the VG disk paths #vgs or vgdisplay -v vg01 If multipath disks are added and configured with VG then we will get disk paths like /dev/mpath0 , /dev/mpath1. 5.If you want to check the disk path status u can use below command also #multipathd -k #multipathd> show multipaths status #multipathd> show topology #multipathd> show paths

How many volume groups can be created in Linux ? Answer :256. I feel this question is unnecessary and In day to day operation,you will never reach this limit. I feel that the below interview questions can help you to find the right candidate. This articles just covers the LVM part. 1.Is it possible to increase the logical volume on fly ? Answer: Yes.We can increase the logical volume without umount it. 2.How to reduce the logical volume ? is it possible to reduce on fly ? Answer: No.You can’t reduce the logical volume on fly. Here is the steps to reduce the logical volume on redhat Linux.  Un-mount the filesystem  Run e2fsck on the volume device  Reduce the Filesystem.(resize2fs)  Reduce the logical Volume(lvreduce)  Mount the filesystem back for production. The detailed step by step guide is available here. 3.How to do you scan the new LUN or disk for LVM physical volume ? Answer:Use “pvscan” to scan existing physical volume from newly connected SAN or DISKS. 4.How to scan disks for existing volume group ? Answer:Use “vgscan” to scan existing volume group from newly connected SAN or DISKS. But you should use “pvscan” prior to executing this command. 5.How to scan a logical volume from exising volume group? Answer: lvscan 6.How to stop the logical volume ? or deactivate the logical volume ? Answer: “lvchange -an /dev/vg_name/lv_name” 7.How to activated the logical volume which in deactivated state ? Answer: “lvchange -ay /dev/vg_name/lv_name” . 8.How to disable the volume group ? or Deactivate the volume group ? Answer:”vgchange -an volume_group_name” . 9.How to enable the volume group ? or Activate the volume group ? Answer:”vgchange -ay volume_group_name” . 10.How do you find that what are the disks are used for logical volume mirroring ? Answer: use “lvs -a -o +devices”

11. What are steps to perform in order to increase the logical volume on fly ? Answer:  Extend the logical volume  Increase the Filesystem size  Verify the status using df command or lvs command. 12.How to list the imported volume groups ? Answer: Use “vgs” command to display the imported volume group. 13.How to list the available logical volumes on the system? Answer: Use “lvs” command to list the available logical volumes on the system. 14.How to list the available physical volumes in LVM? Answer: Use “pvs” command to list the available physical volumes. 15.How to see the detailed volume group information ? Answer: Use “vgdisplay vg_name” 16.How to see the detailed logical volume information ? Answer: Use “lvdisplay /dev/vg_name/lv_name” 17.How to see the detailed physical volume information ? Answer: Use “pvdisplay /dev/disk_name” Ex: pvdisplay /dev/sde 18.How to rename volume Group ? can we rename the VG on fly ? Answer: Yes. Its possible to rename the volume group on fly. But the mounted volumes will not reflect the same unless you re-mount the volume with new VG name. Need to update the /etc/fstab with new VG name to mount the volumes across the system reboot. 19.How to take a LVM configuration backup ? Answer: Use “vgcfgbackup vg_name” to take the latest configuration backup of volume group. The default volume group backup location is “/etc/lvm/backup” . Refer:http://www.unixarena.com/2013/08/linux-lvm-volume-group-operations.html 20. How to re-create the device files for LVM volumes ? Answer: Run “vgmknodes” to recreate the LVM devices files.

21.What is lvmdump ? Answer: “lvmdump” is tool for LVM2 to collect the various information for diagnostic purposes. By default, it creates a tarball suitable for submission along with a problem report.

22.How to replace the failed hard disk in LVM ? 23.How to create a mirrored logical volume ? 24.How to create a striped Logical volume ? 25.How to convert the linear volume to mirror volume ? 26.How are snapshots in LVM2 different from LVM1 in Redhat Linux? Answer:LVM1 snapshots are readonly by default where LVM2 snapshots were read/write. 27.What are the steps involved to create the logical volume from scratch ? Answer: i.Create a physical volume using pvcreate command. #pvcreate /dev/sdc ii.Create a volume group using “vgcreate” command #vgcreate vg02 /dev/sdc iii.Create a logical volume using “lvcreate” command #lvcreate -L 100M -n vol1 vg02 iv.Create a filesystem on logical volume using mkfs command. #mkfs -t ext4 /dev/vg02/vol1 v.Mount the filesystem using mount command for use. #mount -t ext4 /dev/vg02/vol1 /vol1 28.How to extent the volume group ? Answer:Using “vgextend” we can increase the volume group. 29.Assume Volume group “vg02” is already exists. How do you extend the volume group with 50GB ? Provide all the steps with commands. Answer: 1.Get the 50GB lun from SAN team.(/dev/sdd) 2.Create physcical volume ( # pvcreate /dev/sdd ) 2.Extend the volume group (# vgextend vg02 /dev/sdd) 30.If the vg02 has two physical volumes called /dev/sdc/ & /dev/sdd. How do you remove /dev/sdd from vg02. Answer: “vgreduce vg02 /dev/sdd/” 31.How to decommission/remove LVM completely from the host ? Answer: 1.Un-mount all the logical filesystems 2.Remove the logical volumes using “lvremove” command. 3.Destroy the volume group using “vgremove” command. 4.Use “pvremove” command remove the physical volumes from the system. Many more to come …..

Logical Volume Manager:-The set of operating system commands, and other tools that allow us to establish and control logical volume storage is called the Logical Volume Manager (LVM). Also Managing large hard disk farms by letting us add disks, replace disks, copy and share contents from one disk to another without disrupting service (hot swapping).

Which account is created on Linux installation? - With the installation of Linux, a super user account is created called as ‘root’.

Which daemon tracks events on your system? - The syslogd daemon tracks the system information and saves it to specified log files.

Which command would you use if you want to remove the password assigned to a group? - gpasswd – r removes the password from the group. - Here, the gpasswd changes the password of the group and when it is accompanied by –r, the password gets removed.

You wish to print a file ‘draft’ with 60 lines to a page. What command would you use? - The command that I would use is: pr -l60 draft - The default page length when using pr is 66 lines. - The -l option specifies a different length.

Which file would you examine to determine the levels of messages written to system log files? - kernel.h

You are logged on as a regular user. Without logging off and logging on as root, you are required to create a new user account immediately. How would you do it? - This can be achieved by issuing the su command. - This will prompt you for the password of the root account. - Providing the password, logs you in as root. Now, you can perform any administrative duties.

You are required to restore the file memo.ben. It was backed up in the tar file MyBackup.tar. Which command would you use to do it? - The command that we would use is: tar -xvf MyBackup.tar memo.ben - It uses the x switch to extract a file. x – Extract files v – Verbose, print the file names as they are extracted one by one z – The file is a “gzipped” file f – Use the following tar archive for the operation We can extract the files into a specified directory by using the parameter “-C”.

What is partial backup? - When you select only a portion of your file hierarchy or a single partition to back up, it is called partial backup.

What is the fastest way to enter a series of commands from the command-line? - Write the commands, each separated by a semi-colon. Press enter after the last command. - The semi-colon would inform the shell that multiple commands are being entered at the command line, to be executed serially.

What are the qualities of soft links? a.) Soft link files have different inode numbers than source file b.) The soft link file will be of no use if original file is deleted. c.) Soft links are not updated d.) They can create links between directories e.) They can cross file system boundaries

Differentiate between Cron and Anacron. a.) Minimum granularity with Cron is minute while it is in days with Anacron. b.) Cron job can be scheduled by any normal user while Anacron can be scheduled only by the super user. c.) Cron expects the system to be up and running while the Anacron doesn’t expect the system to be up and running all the time. In case of Anacron, if a job is scheduled and the system is down that time, it will execute the job as soon as the system is up and running. d.) Cron is ideal for servers while Anacron is ideal for desktops and laptops. e.) Cron should be used when you want a job to be executed at a particular hour and minute while Anacron should be used in when the job can be executed irrespective of the hour and minute.

What is an INODE? - It is a structure which has the description of all the files and pointers to the data blocks of files stored in it. - The information contained is file-size, access and modification time, permission and so on.

Which command is used to check the number of files and disk space used and the each user’s defined quota? repquota command is used to check the status of the user’s quota along with the disk space and number of files used. This command gives a summary of the user’s quota that how much space and files are left for the user. Every user has a defined quota in Linux. This is done mainly for the security, as some users have only limited access to files. This provides a security to the files from unwanted access. The quota can be given to a single user or to a group of users.

What is the name and path of the main system log? By default, the main system log is '/var/log/messages'. This file contains all the messages and the script written by the user. By default all scripts are saved in this file. This is the standard system log file, which contains messages from all system software, nonkernel boot issues, and messages that go to 'dmesg'. dmesg is a system file that is written upon system boot.

How secured is Linux? Explain. Security is the most important aspect of an operating system. Due to its Unique authentication module, Linux is considered as more secured than other operating systems. Linux consists of PAM. PAM is Pluggable Authentication Modules. It provides a layer between applications and actual authentication mechanism. It is a library of loadable modules which are called by the application for authentication. It also allows the administrator to control when a user can log in. All PAM applications are configured in the directory "/etc/pam.d" or in a file "/etc/pam.conf". PAM is controlled using the configuration file or the configuration directory.

Can Linux machine be made a router so that several machines may share a single Internet connection? How? Yes a Linux machine can be made a router. This is called "IP Masquerade." IP Masquerade is a Networking function in Linux similar to the one-to-many NAT (Network Address Translation) servers found in many commercial firewalls and network routers. The IP Masquerade feature allows other "internal" computers connected to this Linux box (via PPP, Ethernet, etc.) to also reach the Internet as well. Linux IP Masquerading allows this functionality even if the internal computers do not have IP addresses. The IP masquerading can be done by the following steps: 1.The Linux PC must have an internet connection and a connection to LAN. Typically, the Linux PC has two network interfaces:An Ethernet card for the LAN and a Dial-up PPP connection to the Internet (through an ISP). In computer networking, Point-to-Point Protocol (PPP) is a data link layer (layer 2) communications protocol used to establish a direct connection between two nodes. It connects two routers directly without any host or any other networking device in between.

2. All other systems on our LAN use the Linux PC as the default gateway for TCP/IP networking. Use the same ISP-provided DNS addresses on all systems. 3. Enable IP forwarding in the kernel. By default the IP forwarding is not enabled. To ensure that IP forwarding is enabled when you reboot your system, place this command in the /etc/rc.d/rc.local file. 4. Run /sbin/iptables - the IP packet filter administration program-to set up the rules that enable the Linux PC to masquerade for our LAN.

What is the minimum number of partitions that you need to install Linux? Minimum 2 partitions are needed for installing Linux. The one is "/ or root" which contains all the files and the other is swap. Linux file system is function specific which means that files and folders are organized according to their functionality. For example, all executables are in one folder, all devices in another, all libraries in another and so on. "/ or root" is the base of this file system. All the other folders are under this one. "/" can be consider as "C:". Swap is a partition that will be used as virtual memory. If there is no more available RAM, a Linux computer will use an area of the hard disk, called swap, to temporarily store data. In other words It is a way of expanding computers RAM.

Which command is used to review boot messages? dmesg command is used to review boot messages. This command will display system messages contained in the kernel ring buffer. We can use this command immediately after booting to see boot messages. A ring buffer is a buffer of fixed size for which any new data added to it overwrites the oldest data in it. Its basic syntax is: dmesg [options] Invoking dmesg without any of its options causes it to write all the kernel messages to standard output. This usually produces far too many lines to fit into the display screen all at once and thus only the final messages are visible. However, the output can be redirected to the less command through the use of a pipe, thereby allowing the startup messages to be viewed on one screen at a time dmesg | less

Which utility is used to make automate rotation of a log? logrotate command is used to make automate rotation of log. Syntax of the command is: logrotate [-dv] [-f|] [-s|] config_file+ It allows automatic rotation, compression, removal, and mailing of log files. This command is mainly used for rotating and compressing log files. This job is done every day when a log file becomes too large. This command can also be run by giving on command line. We can done force rotation by giving –f option with this command in command line. This command is also used for mailing. We can give –m option for mailing with this command. This option takes two arguments one is subject and other is recipient name.

What are the partitions created on the mail server hard drive? The main partitions are done firstly which are root, swap and boot partition. But for the mail server three different partitions are also done which are as follows: 1. /var/spool - This is done so that if something goes wrong with the mail server or spool than the output cannot overrun the file system. 2. /tmp - Putting this on its own partition prevents any user item or software from overrunning the system files. 3. /home - Putting this on its own is useful for system upgrades or reinstalls. It allow not to wipe off the /home hierarchy along with other areas.

What are the fields in the /etc/passwd file? It contains all the information of the users who log into the system. It contains a list of the system's accounts, giving for each account some useful information like user ID, group ID, home directory, shell, etc. It should have general read permission as many utilities, like ls use it to map user IDs to user names, but write access only for the superuser (root). The main fields of /etc/passwd file are: 1. Username: It is used when user logs in. It should be between 1 and 32 characters in length. 2. Password: An x character indicates that encrypted password is stored in /etc/shadow file. 3. User ID (UID): Each user must be assigned a user ID (UID). UID 0 (zero) is reserved for root and UIDs 1-99 are reserved for other predefined accounts. Further UID 100-999 are reserved by system for administrative and system accounts/groups. 4. Group ID (GID): The primary group ID (stored in /etc/group file) 5. User ID Info: The comment field. It allow you to add extra information about the users such as user's full name, phone number etc. This field use by finger command. 6. Home directory: The absolute path to the directory the user will be in when they log in. If this directory does not exists then users directory becomes / 7. Command/shell: The absolute path of a command or shell (/bin/bash). Typically, this is a shell.

Which commands are used to set a processor-intensive job to use less CPU time? nice command is used for changing priority of the jobs. Syntax: nice [OPTION] [COMMAND [ARG]...] Range of priority goes from -20 (highest priority) to 19 (lowest). Priority is given to a job so that the most important job is executed first by the kernel and then the other least important jobs. This takes less CPU times as the jobs are scheduled and are given priorities so the CPU executes fast. The priority is given by numbers like -20 describe the highest priority and 19 describe the least priority.

***************************************************************** How to change window manager by editing your home directory? "/.xinitrc file" allows changing the window manager we want to use when logging into X from that account. The dot in the file name shows you that the file is a hidden file and doesn't show when you do a normal directory listing. For setting a window manager we have to save a command in this file. The syntax of command is: exec windowmanager. After this, save the file. Next time when you run a startx a new window manager will open and become default. The commands for starting some popular window managers and desktop environments are: -KDE = startkde -Gnome = gnome-session -Blackbox = blackbox -FVWM = fvwm -Window Maker = wmaker -IceWM = icewm

How documentation of an application is stored? When a new application is installed its documentation is also installed. This documentation is stored under the directory named for application. For example if my application name is App1 then the path of the documentation will be /user/doc/App1. It contains all the information about the application. It contains date of creating application, name of application and other important module of the application. We can get the basic information of application from the documentation.

How shadow passwords are given? pwconv command is used for giving shadow passwords. Shadow passwords are given for better system security. The pwconv command creates the file /etc/shadow and changes all passwords to ‘x’ in the /etc/passwd file. /etc/shadow file is only readable by the root user.

In the Linux operating system, a shadow password file is a system file in which encryption user password are stored so that they aren't available to people who try to break into the system. The following is a list of advantages shadow passwords : 

Improves system security by moving encrypted password

First, entries in the shadowed file which don't exist in the main file are removed. Then, shadowed entries which don't have `x' as the password in the main file are updated. Any missing shadowed entries are added. Finally, passwords in the main file are replaced with `x'. These programs can be used for initial conversion as well to update the shadowed file if the main file is edited by hand.

How do you create a new user account? useradd command is used for creating a new user account. When invoked without the -D option, the useradd command creates a new user account using the values specified on the command line and the default values from the system. The new user account will be entered into the system files as needed and initial files copied, depending on the command line options. This command uses the system default as home directory. If –m option is given then the home directory is made.

Which password package is installed for the security of central password? “Shadow password packages” are used for security of central passwords. Security is the most important aspect of every operating system. When this package is not installed the user information including passwords is stored in the /etc/passwd file. The password is stored in an encoded format. These encoded forms can be easily identified by the System crackers by randomly encoding the passwords from dictionaries. The Shadow Package solves the problem by relocating the passwords to another file (usually /etc/shadow). The /etc/shadow file is set so that it cannot be read by just anyone. Only root will be able to read and write to the /etc/shadow file.

Which shell do you assign to a POP3 mail-only account? POP3 mail only account is assigned to the /bin/false shell. However, assigning bash shell to a POP3 mail only gives user login access, which is avoided. /bin/nologin can also be used. This shell is provided to the user when we don’t want to give shell access to the user. The user cannot access the shell and it reject shell login on the server like on telnet. It is mainly for the security of the shells. POP3 is basically used for downloading mail to mail program. So for illegal downloading of emails on the shell this account is assigned to the /bin/false shell or /bin/nologin. These both shells are same they both do the same work of rejecting the user login to the shell. The main difference between these two shells is that false shell shows the incorrect code and any unusual coding when user login with it. But the nologin shell simply tells that no such account is available. So nologin shell is used mostly in Linux.

Which daemon is responsible for tracking events on Linux system? syslogd is responsible for tracking system information and save it to the desired log files. It provides two system utilities which provide system logging and kernel message trapping. Internet and UNIX domain sockets support enable this utility package to support both local and remote logging. Every logged message contains at least a time and a hostname field, normally a program name field, too. So to track these information this daemon is used. syslogd mainly reacts to the set of signals given by the user. These are the signals given to syslogd: - SIGHUP: This lets syslogd perform a re-initialization. All open files are closed, the configuration file (default is /etc/syslog.conf) will be reread and the syslog facility is started again. - SIGTERM: The syslogd will die. - SIGINT, SIGQUIT: If debugging is enabled these are ignored, otherwise syslogd will die. - SIGUSR1: Switch debugging on/off. This option can only be used if syslogd is started with the d debug option. - SIGCHLD: Wait for Childs if some were born, because of waiting messages.

Which daemon is used for scheduling of the commands? The crontab command is used for scheduling of the commands to run at a later time. SYNTAX crontab [ -u user ] file crontab [ -u user ] { -l | -r | -e }

Options -l List - display the current crontab entries. -r Remove the current crontab.

-e Edit the current crontab using the editor specified by the VISUAL or EDITOR environment variables. When user exits from the editor, the modified crontab will be installed automatically. Each user can have their own crontab, and though these are files in /var, they are not intended to be edited directly. If the –u option is given than the crontab gives the name of the user whose crontab is to be tweaked. If it is given without this then it will display the crontab of the user who is executing the command.

How environment variable is set so that the file permission can be automatically set to the newly created files? umask command is used to set file permission on newly created files automatically. Syntax umask [-p] [-S] [mode] It is represented in octal numbers. We can simply use this command without arguments to see the current file permissions. To change the permissions, mode is given in the arguments. The default umask used for normal user is 0002. The default umask for the root user is 0022. For calculating the original values, the values shown by the umask must be subtracted by the default values. It is mainly used for masking of the file and directory permission. The /etc/profile script is where the umask command is usually set for all users. The –S option can be used to see the current default permissions displayed in the alpha symbolic format. For example, umask 022 ensures that new files will have at most 755 permissions (777 NAND 022). The permissions can be calculated by taking the NAND of original value with the default values of files and directories.

What is LILO? LILO is Linux Loader is a boot loader for Linux. It is used to load Linux(PC BIOS) into the memory and start the Operating system(Kernel). LILO can be configured to boot other operating systems as well. LILO is customizable, which means that if the default configuration is not correct, it can be changed. Config file for LILO is lilo.conf. The selection of various kernel images and boot routines is supported by LILO. For this reason, LILO is known as boot manager.

Top Answers to Linux Interview Questions 1. Compare Linux & Windows Criteria

Linux

Windows

Type of OS

Open Source

Proprietary

Customization

High level of customization

Cannot be changed

Security

Excellent

Cannot be changed

3. You wish to print a file ‘draft’ with 60 lines on a page. What command would you use? The command used : pr -l60 draft  

The default page length when using pr is 66 lines. The -l option specifies a different length.

4. What is LD_LIBRARY_PATH? 

 

LD_LIBRARY_PATH is an environment variable. It is used for debugging a new library or a non-standard library. It is also used to identify what directories need to be searched. Path to search for directories needs to given. The variable can be set using setenv—LD_LIBRARY_PATH–$PATH. It is used to search for the shared objects / dynamic libraries by the operating system for extendable functionality at runtime.

5. Name a service that you should disable (which acts both as Web and FTP Server) on a Linux Server.

The finger service should be disabled because a remote user can get important information about the system by using that command. 6. What does Sar provide? Where are Sar logs stored?

Sar collects, reports, or saves system activity information, sar serves to log and evaluate a variety of information regarding system activity. With performance problems, sar also permits retroactive analysis of the load values for various sub-systems (CPUs, memory, disks, interrupts, network interfaces and so forth) and limitation of problems in this manner. If CPU utilization is near 100 % (user + nice + system), the workload sampled is CPU-bound. By default, log files of Sar command is located at /var/log/sa/sadd file, where dd parameter indicates the current day. 7. How to check Memory stats and CPU stats as a Linux admin?

Using ‘free’ & ‘vmstat’ command, we can display the physical and virtual memory statistics, respectively. With the help of ‘sar’ command, we can see the CPU utilization & other stats.

9. What are the different modes of Network bonding in Linux? Below are list of modes used in Network Bonding :       

balance-rr or 0 – round-robin mode for fault tolerance and load balancing. active-backup or 1 – Sets active-backup mode for fault tolerance. balance-xor or 2 – Sets an XOR (exclusive-or) mode for fault tolerance and load balancing. broadcast or 3 – Sets a broadcast mode for fault tolerance. All transmissions are sent on all slave interfaces. 802.3ad or 4 – Sets an IEEE 802.3ad dynamic link aggregation mode. Creates aggregation groups that share the same speed & duplex settings. balance-tlb or 5 – Sets a Transmit Load Balancing (TLB) mode for fault tolerance & load balancing. balance-alb or 6 – Sets an Active Load Balancing (ALB) mode for fault tolerance & load balancing.

10. How to check and verify the status of the bond interface?

Using the command ‘cat /proc/net/bonding/bond0,’ we can check what mode is enabled and what LAN cards are used in this bond. In this example, we have one bond interface. However, we can have multiple bond interfaces like bond1, bond2 and so on. 11. How can you enhance the security of password file?

Linux keep user account information in a text file called /etc/passwd. This file also stores one way encrypted password. It is accessed by several tools to get user information, which is a security risk, so file need to ‘Word Readable.’ To minimize the security risk, you can use shadow password format. This method saves account information in regular file /etc/passwd. However, the password is stored as a single “x” character (not actually stored in this file). A second file, called “/etc/shadow” contains encrypted password as well as other information such as account or password expiration values, etc. The /etc/shadow file is readable only by the root account and is therefore less of a security risk

12. What command can you use to make a tape archive file of a /home directory and send it to the /dev/tape device?

The correct command is tar -xvf /dev/tape /home. The -xvf option is used to extract files from an archive.

13. Suppose your FTP Server is hacked and the entire server needs to be restored. How should you restore the original kernel system files?

We cannot restore the entire operating system from tape backup device. So we should reinstall the core operating system, and then restore system configuration files and user data from tape backup device. 14. Why should we avoid Telnet to administer a Linux system remotely?

Telnet uses most insecure method for communication. It sends data across the network in plain text format and anybody can easily find out the password using the network tool. In the case of Telnet, these include the passing of login credentials in plain text, which means anyone running a sniffer on your network can find the information he needs to take control of a device in a few seconds by eavesdropping on a Telnet login session. 15. What is Puppet Server?

Puppet is an open-source software for configuration management tool. It runs on many Unix-like systems as well as on Microsoft Windows, and includes its own declarative language to describe system configuration. Puppet is an IT automation software that is used to push configuration to its clients (puppet agents) using code. Puppet code can do multiple tasks from installing new software to checking file permissions to updating user accounts. 16. What is the difference between Cron and Anacron? 1. Minimum granularity with Cron is minute while it is in days with Anacron. 2. Cron job can be scheduled by any normal user while Anacron can be scheduled only by the super user (the superuser is a special user account used for system administration. Depending on the operating system (OS), the actual name of this account might be root,administrator, admin or supervisor) 3. Cron expects the system to be up and running while the Anacron doesn’t expect the system to be up and running all the time. In case of Anacron, if a job is scheduled and the system is down that time, it will execute the job as soon as the system is up and running. 4. Cron is ideal for servers while Anacron is ideal for desktops and laptops. 5. Cron should be used when you want a job to be executed at a particular hour and minute while Anacron should be used in when the job can be executed irrespective of the hour and minute.

17. What command is used to check the number of files, disk space and each user’s defined quota?

repquota command is used to check the status of the user’s quota along with the disk space and number of files used. This command gives a summary of the user’s quota that how much space and files are left for the user. Each user has a defined quota in Linux. This is done mainly for the security as some users have only limited access to files. This provides a security to the files from unwanted access. The quota can be given to a single user or to a group of users. 18. What is the name and path of the main system log?

By default, the main system log is ‘/var/log/messages’. This file contains all the messages and the script written by the user. By default, all scripts are saved in this file. This is the standard system log file, which contains messages from all system software, non-kernel boot issues, and messages that go to ‘dmesg’. dmesg is a system file that is written upon system boot. 19. Can Linux computer be made a router so that several machines may share a single Internet connection? How? Yes, a Linux machine can be made a router. This is called “IP Masquerade.” IP Masquerade is a networking function in Linux similar to the one-to-many (1: Many) NAT (Network Address Translation) servers found in many commercial firewalls and network routers. The IP Masquerade feature allows other “internal” computers connected to this Linux box (via PPP, Ethernet, etc.) to also reach the Internet as well. Linux IP Masquerading allows this functionality even if the internal computers do not have IP addresses. The IP masquerading can be done by the following steps : 

 



The Linux PC must have an internet connection and a connection to LAN. Typically, the Linux PC has two network interfaces-an Ethernet card for the LAN and a dial-up PPP connection to the Internet (through an ISP). All other systems on your LAN use the Linux PC as the default gateway for TCP/IP networking. Use the same ISP-provided DNS addresses on all systems. Enable IP forwarding in the kernel. By default the IP forwarding is not enabled. To ensure that IP forwarding is enabled when you reboot your system, place this command in the /etc/rc.d/rc.local file. Run /sbin/iptables-the IP packet filter administration program-to set up the rules that enable the Linux PC to masquerade for your LAN.

24. If a volume group named VG0 already exists and we need to extend this volume group up to 4GB. How will you do it?  

Firstly create Physical volume (/dev/sda7) of size 4GB. Now run following command. vgextend VG0 /dev/sda7

25. Is there any relation between modprobe.conf file and network devices?

Yes, this file assigns a kernel module to each network device. For Example :[root@localhost ~]# cat /etc/modprobe.conf alias eth0 b44 Here, b44 is the kernel module for network device eth0. We can confirm whether this module “b44” is present or not by the following command [root@localhost ~]# lsmod |grep b44 b44 29005 0

26. What is YUM?

YUM stands for Yellow dog Updater, Modified because it is based on YUP, the Yellow dog Updater. Where does the name Yellow dog come from? Yellow Dog is a version of Linux for the Power Architecture hardware and is RPM-based, just like Red Hat Enterprise Linux and Fedora. YUP, and later YUM, were written by the Linux community as a way to maintain an RPM-based system 27. What is the role of Kudzu?

Kudzu is used to detect new Hardware. RedHat Linux runs a hardware discoverer, named kudzu. When attempting to identify a serial port Kudzu resets the serial port. This stops the serial console. Kudzu is configured from the file/etc/sysconfig/kudzu. Kudzu can be prevented from resetting hardware, by setting the configuration parameter SAFE to yes.

28. What is the difference between ext2 and ext3 file systems?   



The ext3 file system is an enhanced version of the ext2 file system. The most important difference between Ext2 and Ext3 is that Ext3 supports journaling. After an unexpected power failure or system crash (also called an unclean system shutdown), each mounted ext2 file system on the machine must be checked for consistency by the e2fsck program. This is a time-consuming process and during this time, any data on the volumes is unreachable.

The journaling provided by the ext3 file system means that the file system consistency check is no longer necessary after an unclean system shutdown. The consistency check occurs using ext3 is in certain rare hardware failure cases, such as hard drive failures. The time to recover an ext3 file system after an unclean system shutdown does not depend on the size of the file system or the number of files. Rather, it depends on the size of the journal used to maintain consistency. The default journal size takes almost a second to recover, depending on the speed of the hardware.

29. Explain /proc filesystem?

/proc is a virtual file system that provides detailed information about Linux kernel, hardware and running processes. Files under /proc directory named as Virtual files. Since /proc contains virtual files, it is called virtual file system. These virtual files have unique qualities. Most of them are listed as zero bytes in size. Virtual files such as /proc/interrupts, /proc/meminfo, /proc/mounts, and /proc/partitions provide an up-to-the-moment glimpse of the system’s hardware. Others: /proc/filesystems file and the /proc/sys/ directory provide system configuration information and interfaces.

30. How do you create ext4 file system?

# mke2fs -t ext4 /dev/DEV 31. How to Enable ACLs for /home partition? Add following LABEL=/home /home Now remount /home mount -t ext3 -o acl /dev/sda3 /home

entry ext3 partition

in acl with

1 acl

/etc/fstab 2 option.

Q:1 Why LVM is required ? Ans: LVM stands for Logical Volume Manager , to resize filesystem’s size online we required LVM partition in Linux. Size of LVM partition can be extended and reduced using the lvextend & lvreduce commands respectively. Q:2 How To check Memory stats and CPU stats ? Ans: Using ‘free’ & ‘vmstat’ command we can display the physical and virtual memory statistics respectively.With the help of ‘sar’ command we see the CPU utilization & other stats.

Q:4 How to increase the size of LVM partition ? Ans: Below are the Logical Steps : – Use the lvextend command (lvextend -L +100M /dev/ , in this example we are extending the size by 100MB. – resize2fs /dev/ – check the size of partition using ‘df -h’ command

Q:5 How to reduce or shrink the size of LVM partition ? Ans: Below are the logical Steps to reduce size of LVM partition : -Umount the filesystem using umount command, -use resize2fs command , e.g resiz2fs /dev/mapper/myvg-mylv 10G -Now use the lvreduce command , e.g lvreduce -L 10G /dev/mapper/myvg-mylv Above Command will shrink the size & will make the filesystem size 10GB.

Q:6 How to create partition from the raw disk ? Ans: Using fdisk utility we can create partitions from the raw disk. Below are the steps to create partition from the raw dsik : – fdisk /dev/hd* (IDE) or /dev/sd* (SCSI) – Type n to create a new partition – After creating partition , type w command to write the changes to the partition table. Q:7 Where the kernel modules are located ? Ans: The ‘/lib/modules/kernel-version/’directory stores all kernel modules or compiled drivers in Linux operating system. Also with ‘lsmod’ command we can see all the installed kernel modules. Q:8 What is umask ? Ans: umask stands for ‘User file creation mask’, which determines the settings of a mask that controls which file permissions are set for files and directories when they are created. Q:9 How to set the umask permanently for a user? Ans: To set this value permanently for a user, it has to be put in the appropriate profile file which depends on the default shell of the user. /etc/profile script file.

Q:10 How to change the default run level in linux ? Ans: To change the run level we have to edit the file “/etc/inittab” and change initdefault entry ( id:5:initdefault:). Using ‘init’ command we change the run level temporary like ‘init 3’ , this command will move the system in runlevl 3. Q:11 How to share a directory using nfs ? Ans: To share a directory using nfs , first edit the configuration file ‘/etc/exportfs’ , add a entry like ‘/ (Options)’ and then restart the nfs service. Q:12 How to check and mount nfs share ? Ans: Using ‘showmount’ command we can see what directories are shared via nfs e.g ‘showmount -e ’. Using mount command we can mount the nfs share on linux machine. Q:13 What are the default ports used for SMTP,DNS,FTP,DHCP,SSH and squid ? Ans: Service Port SMTP 25 DNS 53 FTP 20 (data transfer) , 21 ( Connection established) DHCP 67/UDP(dhcp server) , 68/UDP(dhcp client) SSH 22 Squid 3128

Q:14 What is Network Bonding ? Ans: Network bonding is the aggregation of multiple LAN cards into a single bonded interface to provide fault tolerance and high performance. Network bonding is also known as NIC Teaming. Q:15 What are the different modes of Network bonding in Linux ? Ans: Below are list of modes used in Network Bonding : balance-rr or 0 – round-robin mode for fault tolerance and load balancing. active-backup or 1 – Sets active-backup mode for fault tolerance. balance-xor or 2 – Sets an XOR (exclusive-or) mode for fault tolerance and load balancing. broadcast or 3 – Sets a broadcast mode for fault tolerance. All transmissions are sent on all slave interfaces. 802.3ad or 4 – Sets an IEEE 802.3ad dynamic link aggregation mode. Creates aggregation groups that share the same speed & duplex settings. balance-tlb or 5 – Sets a Transmit Load Balancing (TLB) mode for fault tolerance & load balancing. balance-alb or 6 – Sets an Active Load Balancing (ALB) mode for fault tolerance & load balancing.

Q:16 How to check and verify the status of bond interface. Ans: Using the command ‘cat /proc/net/bonding/bond0’ , we can check which mode is enabled and what lan cards are used in this bond. In this example we have one only one bond interface but we can have multiple bond interface like bond1,bond2 and so on. Q:17 How to check default route and routing table ? Ans: Using the Commands ‘netstat -nr’ and ‘route -n’ we can see the default route and routing tables. Q:18 How to check which ports are listening in my Linux Server ? Ans: Use the Command ‘netstat --listen’ and ‘lsof -i’

Q:19 List the services that are enabled at a particular run level in linux server ? Ans: With the help of command ‘chkconfig --list | grep 5:on’ we can list all the service that are enabled in run level5. For other run levels just replace 5 with the respective run level.

Q:20 How to enable a service at a particular run level ? Ans: We can enable a service using the Command ‘chkconfig <Service-Name> on –level 3’ Q:21 How to upgrade Kernel in Linux ? Ans: We should never upgrade Linux Kernel , always install the new New kernel using rpm command because upgrading a kenel can make your linux box in a unbootable state. ******Q:22 How To scan newly asssigned luns on linux box without rebooting ? Ans: There are two ways to scan newly assigned luns : Method:1 if sg3 rpm is installed , then run the command ‘rescan-scsi-bus.sh’ Method:2 Run the Command , echo ” – – – ” > /sys/class/scsi_host/hostX/scan

*****Q:23 How to find WWN numbers of HBA cards in Linux Server ? Ans: We can find the WWN numbers of HBA cards using the command ‘systool -c fc_host -v | grep port_name’

****Q:24 How to add & change the Kernel parameters ? Ans: To Set the kernel parameters in linux , first edit the file ‘/etc/sysctl.conf’ after making the changes save the file and run the command ‘sysctl -p’ , this command will make the changes permanently without rebooting the machine.

Q:26 What are manifests in Puppet ? Ans: Manifests in Puppet are the files in which the client configuration is specified.

*****Q:27 Which Command is used to sign requested certificates in Puppet Server ? Ans: ‘puppetca –sign hostname-of-agent’ in (2.X) & ‘puppet ca sign hostname-of-agent’ in (3.X) *****Q:28 At which location Puppet Master Stores Certificates ? Ans: /var/lib/puppet/ssl/ca/signed Q:29 How to find all the regular files in a directory ? Ans: using the command ‘find /
Popular skills for Linux System Administrators 1. What is the core of the Linux OS? This question is fairly basic, so apart from mentioning that the core is Kernel, you should also mention its component parts. This would include Shell, Command, Script, and Terminal. What is the difference between Linux and UNIX? Here, you’ll have to remember to mention that Linux is based on UNIX, apart from the fact that it is an open source software, while UNIX is not. 4. Explain the boot process of the Unix system This is a fairly open-ended question, but as Allen Wittenauer points out, ‘open-ended questions are asked so you can demonstrate your familiarity and knowledge of the system’. (Click To Tweet) When you answer this question, talk about the BIOS, MBR, LILO, and GRUB. 5. What is your favourite shell and why? Just about any platform discussing interview questions for Linux system administrators mentions this, including the list of questions to ask interviewees by Chander Shivdasani. Whether you go with tcsh, csh, or BASH, make sure you’re clear on the features of all and are able to support your preference with facts and examples. 6. What is the swap space or virtual memory? The swap space is used by Linux to hold programs that are running concurrently when the RAM runs out of space. 8. Discuss IPtables It’s the basics of Firewall for Linux. Iptables is a rule based firewall system and it is normally pre-installed on a Unix operating system. controlling the incoming and outgoing packets/traffic. By-default the iptables is running without any rules, we can create, add, edit rules into it.

9. What is a zombie process?

A zombie process or defunct process is a process that has completed executed (via the exit system call) but still has an entry in the process table. It is a process in the "Terminated state". You should be able to describe it as one where the child process is terminated before the parent process, leaving it running on the process table. 15. What is the advantage of open source? The best thing about open source is the fact that it allows people to create forks and distribute their own version of the software, leading to versatility. People can then debug the code and make it run better before distributing it again. A greater number of people working on the code means that it’s more likely that bugs will be identified and squashed. 16. What are symbolic links? symbolic links are similar to shortcuts on Windows. Allow instant access to programs, files, and directories without having to go to the pathname. 17. How do you share a program across different virtual desktops under Linux? The answer to this is fairly straightforward. But break down the process by starting with the icon that looks like a pushpin on the upper left corner. Tell them how pressing this button will “pin” that application in place, making it appear in all the virtual desktops, in the same position on screen. 18. What are the kinds of permissions under Linux? Speak about the 3 different kinds of permissions on Linux.   

Read: users can read the files or list the directory Write: users may write to the file or add new files to the directory Execute: users may run the file or lookup a specific file within a directory

19. What could possibly be the problem when a command that was issued gave a different result from the last time it was used?

Explain how since Linux is case sensitive. The command in question was probably entered in a different format. Cite an example of how you should type ‘ls’ to list all the files in a directory. Using ‘LS’ could produce a different result. 20. How do you terminate an ongoing process? Explain how every process in the system is identified by a unique process id or pid. Using the ‘kill’ command followed by pid terminates that process. You can add a line on how to terminate all processes at once, by using kill 0. 21. What are filenames that are preceded by a dot? It’s basic knowledge that filenames that are preceded by a dot are hidden files. You can tell your interviewer how these files may hold important data or setup info, and hiding them makes it less likely that they’ll get accidentally deleted. 22. What are the different modes when using vi editor? Remember, there are 3 modes under vi:   

Command mode: the mode you start in Edit mode: the mode that allows text editing Ex mode: the mode where you interact with vi to process a file

23. **********What is redirection? It’s a fairly simple process, allowing you to direct data from one output to another. You can also use it to direct an output as an input to another process. 24. How do you insert comments in the command line prompt? All you need to do is type the ‘#’ symbol before you type a piece of text. Explain to your interviewer how typing ‘#’ tells the shell to completely ignore what follows.

1) What is Linux? Linux is an operating system based on UNIX. It is based on the Linux Kernel, and can run on different hardware platforms

2) What is the difference between UNIX and LINUX? Unix originally began as a propriety operating system from Bell Laboratories, which later on spawned into different commercial versions. On the other hand, Linux is free, open source and intended as a non-propriety operating system for the masses. 3) What is BASH? BASH is short for Bourne Again SHell. It was written by Steve Bourne as a replacement to the original Bourne Shell (represented by /bin/sh). It combines all the features from the original version of Bourne Shell, plus additional functions to make it easier and more convenient to use. It has since been adapted as the default shell for most systems running Linux. #!/bin/sh or #!/bin/bash bash and sh are two different shells. Basically bash is sh, with more features and better

syntax. #!/bin/sh or #!/bin/bash has to be first line of the script because if you don't use it on the

first line then the system will treat all the commands in that script as different commands. If the first line is #!/bin/sh then it will consider all commands as a one script and it will show the that this file is running in ps command and not the commands inside the file. ./echo.sh ps -ef |grep echo trainee 3036 2717 0 16:24 pts/0 00:00:00 /bin/sh ./echo.sh root 3042 2912 0 16:24 pts/1 00:00:00 grep --color=auto echo

4) What is Linux Kernel? The Linux Kernel is a low-level systems software whose main role is to manage hardware resources for the user. It is also used to provide an interface for user interaction.

The Linux kernel is an operating system (OS) kernel defined as Unix-like in nature. It used in different operating systems, mostly in the form of different Linux distributions. The Linux kernel was the first truly complete and prominent example of free and opensource software .

6) What is a swap space? A swap space is a certain amount of space used by Linux to temporarily hold some programs that are running concurrently. This happens when RAM does not have enough memory to hold all programs that are executing.

7) What is the advantage of open source? Open source allows you to distribute your software, including source codes freely to anyone who is interested. People would then be able to add features and even debug and correct errors that are in the source code. They can even make it run better, and then redistribute these enhanced source code freely again. This eventually benefits everyone in the community. 8 ) What are the basic components of Linux? Just like any other typical operating system, Linux has all of these components: kernel, shells and GUIs, system utilities, and application program. What makes Linux advantageous over other operating system is that every aspect comes with additional features and all codes for these are downloadable for free. ********9) Does it help for a Linux system to have multiple desktop environments installed? In general, one desktop environment, like KDE or Gnome, is good enough to operate without issues. It’s all a matter of preference for the user, although the system allows switching from one environment to another. Some programs will work on one environment and not work on the other, so it could also be considered a factor in selecting which environment to use. 10) What is the basic difference between BASH and DOS? The key differences between the BASH and DOS console lies in 3 areas: – BASH commands are case sensitive while DOS commands are not; – under BASH, / character is a directory separator and \ acts as an escape character. Under DOS, / serves as a command argument delimiter and \ is the directory separator – DOS follows a convention in naming files, which is 8 character file name followed by a dot and 3 character for the extension. BASH follows no such convention. **********11) What is the importance of the GNU project? This so-called Free software movement allows several advantages, such as the freedom to run programs for any purpose and freedom to study and modify a program to your needs. It also allows you to redistribute copies of a software to other people, as well as freedom to improve software and have it released to the public. 12) Describe the root account. The root account is like a systems administrator account, and allows us full control of the system. Here you can create and maintain user accounts, assigning different permissions for each account. It is the default account every time you install Linux.

13) What is CLI? CLI is short for Command Line Interface. This interface allows user to type declarative commands to instruct the computer to perform operations. CLI offers an advantage in that there is greater flexibility. However, other users who are already accustom with using GUI find it difficult to remember commands including attributes that come with it.

14) What is GUI? GUI, or Graphical User Interface, makes use of images and icons that users click and manipulate as a way of communicating with the computer. Instead of having to remember and type commands, the use of graphical elements makes it easier to interact with the system, as well as adding more attraction through images, icons and colors. 16) How can you find out how much memory Linux is using? From a command shell, use the “concatenate” command: cat /proc/meminfo for memory usage information. You should see a line starting something like: Mem: 64655360, etc. This is the total memory Linux thinks it has available to use. Also:-

vmstat -s cat /proc/meminfo free -m

17) What is typical size for a swap partition under a Linux system? The preferred size for a swap partition is twice the amount of physical memory available on the system. If this is not possible, then the minimum size should be the same as the amount of physical memory installed. 19) Does the Ctrl+Alt+Del key combination work on Linux? Yes, it does. Just like Windows, you can use this key combination to perform a system restart. One difference is that you won’t be getting any confirmation message and therefore, reboot is immediate.

21) Are drives such as harddrive and floppy drives represented with drive letters? No. In Linux, each drive and device has different designations. For example, floppy drives are referred to as /dev/fd0 and /dev/fd1. IDE/EIDE hard drives are referred to as /dev/hda, /dev/hdb, /dev/hdc, and so forth.

22) How do you change permissions under Linux? Assuming you are the system administrator or the owner of a file or directory, you can grant permission using the chmod command. Use + symbol to add permission or – symbol to deny permission, along with any of the following letters: u (user), g (group), o (others), a (all), r (read), w (write) and x (execute). For example the command chmod go+rw FILE1.TXT grants read and write access to the file FILE1.TXT, which is assigned to groups and others.

*******23) In Linux, what names are assigned to the different serial ports? Serial ports are identified as /dev/ttyS0 to /dev/ttyS7. These are the equivalent names of COM1 to COM8 in Windows. 24) How do you access partitions under Linux? Linux assigns numbers at the end of the drive identifier. For example, if the first IDE hard drive had three primary partitions, they would be named/numbered, /dev/hda1, /dev/hda2 and /dev/hda3. 25) What are hard links? Hard links point directly to the physical file on disk, and not on the path name. This means that if you rename or move the original file, the link will not break, since the link is for the file itself, not the path where the file is located. 26) What is the maximum length for a filename under Linux? Any filename can have a maximum of 255 characters. This limit does not include the path name, so therefore the entire pathname and filename could well exceed 255 characters. 27)What are filenames that are preceded by a dot? In general, filenames that are preceded by a dot are hidden files. These files can be configuration files that hold important data or setup info. Setting these files as hidden makes it less likely to be accidentally deleted.

28) Explain virtual desktop. This serves as an alternative to minimizing and maximizing different windows on the current desktop. Using virtual desktops, each desktop is a clean slate where you can open one or more programs. Rather than minimizing/restoring all those programs as needed, you can simply shuffle between virtual desktops with programs intact in each one.

29) How do you share a program across different virtual desktops under Linux? To share a program across different virtual desktops, in the upper left-hand corner of a program window look for an icon that looks like a pushpin. Pressing this button will “pin” that application in place, making it appear in all virtual desktops, in the same position onscreen. 30) What does a nameless (empty) directory represent? This empty directory name serves as the nameless base of the Linux file system. This serves as an attachment for all other directories, files, drives and devices. 31) What is the pwd command? The pwd command is short for print working directory command. It’s counterpart in DOS is the cd command, and is used to display the current location in the directory tree.

32) What are daemons? Daemons are services that provide several functions that may not be available under the base operating system. Its main task is to listen for service request and at the same time to act on these requests. After the service is done, it is then disconnected and waits for further requests.

Examples of daemons that it starts include crond (which runs scheduled tasks), ftpd (file transfer), lpd (laser printing), rlogind(remote login), rshd (remote command execution) and telnetd (telnet).

33) How do you switch from one desktop environment to another, such as switching from KDE to Gnome? Assuming you have these two environments installed, just log out from the graphical interface. Then at the Log in screen, type your login ID and password and choose which session type you wish to load. This choice will remain your default until you change it to something else.

35) How does case sensitivity affect the way you use commands? When we talk about case sensitivity, commands are considered identical only if every character is encoded as is, including lowercase and uppercase letters. This means that CD, cd and Cd are three different commands. Entering a command using uppercase letters, where it should be in lowercase, will produce different outputs.

What are Environment variables? Environment variables are dynamic values which affect the processes or programs on a computer. They exist in every operating system, but the types may vary. Environment variables can be created, edited, saved, and deleted and give information about the system behavior. E.g. $LANG environment variable stores the value of the language that the user understands.

a) printenv command – Print all environment variables. b) env command – Print all environment in a modified environment. c) set command – Print the name and value of each shell variable.

Example of linux environmental variable Let take a simple example of ls command to understand linux environmental variables. ls the basic command to list the content of directory. When execute a command in linux, you need to type the full path of that command. Since the ls command is in the /bin directory, users should execute the /bin/ls command to list files in the current directory. export PATH="${PATH}:/home/user1/custom_script"

How to set linux environmental variable permanently Defining Variables Locally As you seen temporary variables are available only on that session. We can make those variables permanent. For security reason you should not define an environment variable globally unless you have sound understanding of linux system. For instance, you might want to add /home/user_name/custom_script to the PATH variable for a particular user. In such a case define it locally. As you do not want all other users on your system to have that in their PATH too. The following files should be used for local environment variables on your system: ~/. profile, ~/.bash_profile, ~/.bash_login and ~/.bash_logout.

https://www.computernetworkingnotes.com/command-line-tools/linux-environmentvariables.html

list of the commonly used Environment variables in Linux:Your login terminal type.

echo $TERM export TERM=vt100

SHELL

Set path to login shell.

echo $SHELL

DISPLAY

Set X display name

echo $DISPLAY export DISPLAY=:0.1

EDITOR

Set name of default text editor.

export EDITOR=/usr/bin/vim

Used to determine the locale category for any category not specifically selected with a variable starting with LC_.

echo $LANG

The search path for commands. It is a colonseparated list of directories in which the shell looks for commands.

echo $PATH

The home directory of the current user.

echo $HOME

The name of the your computer.

echo $HOSTNAME

TERM

LANG

PATH

HOME

HOSTNAME

38) Is it possible to use shortcut for a long pathname? Yes, there is. A feature known as filename expansion allows you do this using the TAB key. For example, if you have a path named /home/iceman/assignments directory, you would type as follows: /ho[tab]/ice[tab]/assi[tab] . This, however, assumes that the path is unique, and that the shell you’re using supports this feature.

39) What is redirection? Redirection is the process of directing data from one output to another. It can also be used to direct an output as an input to another process. 40) What is grep command? grep a search command that makes use of pattern-based searching. It makes use of options and parameters that is specified along the command line and applies this pattern into searching the required file output. 41) What could possibly be the problem when a command that was issued gave a different result from the last time it was used? One highly possible reason for getting different results from what seems to be the same command has something to do with case sensitivity issues. Since Linux is case sensitive, a command that was previously used might have been entered in a different format from the present one. For example, to lists all files in the directory, you should type the command ls, and not LS. Typing LS would either result in an error message if there is no program by that exact name exist, or may produce a different output if there is a program named LS that performs another function. 42) What are the contents in /usr/local? It contains locally installed files. This directory actually matters in environments where files are stored on the network. Specifically, locally-installed files go to /usr/local/bin, /usr/local/lib, etc.). Another application of this directory is that it is used for software packages installed from source, or software not officially shipped with the distribution. 45) What is command grouping and how does it work? You can use parentheses to group commands. For example, if you want to send the current date and time along with the contents of a file named OUTPUT to a second file named MYDATES, you can apply command grouping as follows: (date cat OUTPUT) > MYDATES 46) How do you execute more than one command or program from a single command line entry? You can combine several commands by separating each command or program using a semicolon symbol. For example, you can issue such a series of commands in a single entry:

1 ls –l cd .. ls –a MYWORK which is equivalent to 3 commands: ls -l cd.. ls -a MYWORK

**Note that this will be executed one after the other, in the order specified.

47) Write a command that will look for files with an extension “c”, and has the occurrence of the string “apple” in it. Answer:

1

Find ./ -name “*.c” | xargs grep –i “apple”

48) Write a command that will display all .txt files, including its individual permission. Answer:

1 ls -a -l *.txt

49) Write a command that will do the following: -look for all files in the current and subsequent directories with an extension c,v -strip the ,v from the result (you can use sed command) -use the result and use a grep command to search for all occurrences of the word ORANGE in the files.

1 Find ./ -name “*.c,v” | sed ‘s/,v//g’ | xargs grep “ORANGE”

50) What, if anything, is wrong with each of the following commands? a) ls -l-s b) cat file1, file2 c) ls – s Factdir Answers: a) there should be space between the 2 options: ls -l -s

b) do not use commas to separate arguments: cat file1 file2 c) there should be no space between hyphen and option label: ls –s Factdir 51) What is the command to calculate the size of a folder? To calculate the size of a folder use the command du –sh folder1. 52) How can you find status of a process? Use the command ps ux 53) How can you check the memory status ? You can use the command free -m to display output in MB free -g to display output in GB

54) Explain how to color the Git console? To color the Git console you can use the command git config—global color.ui auto. In the command, the color.ui variable sets the default value for variable such as color.diff and color.grep. 55) How can you append one file to another in Linux? To append one file to another in Linux you can use command cat file2 >> file 1. The operator >> appends the output of the named file or creates the file if it is not created. While another command cat file 1 file 2 > file 3 appends two or more files to one. 56) Explain how you can find a file using Terminal? To find a file you have to use command, find . –name “process.txt” . It will look for the current directory for a file called process.txt. 57) Explain how you can create a folder using Terminal? To create a folder, you have to use command mkdir. It will be something like these : ~$ mkdir Guru99 58) Explain how you can view the text file using Terminal? To view the text file, go to the specific folder where the text files are located by using the command cd and then type less filename.txt. 59) Explain how to enable curl on Ubuntu LAMP stack? To enable curl on Ubuntu , first install libcurl, once done use following command sudo/etc/init .d /apache2 restart or sudo service apache2 restart.

60) Explain how to enable root loging in Ubuntu? The command which enables root loging is #sudo sh-c ‘echo “greater-show-manual-login=true” >>/etc/lightdm/lightdm.conf’ 61) How you can run an Linux program in the background simultaneously when you start your Linux Server? By using nohup. It will stop the process receiving the NOHUP signal and thus terminating it you log out of the program which was invoked with. & runs the process in the background. 62) Explain how to uninstall the libraries in Linux? To uninstall the libraries in Linux, you can use command sudo apt – get remove library_name

6 Stages of Linux Boot Process (Startup Sequence) by RAMESH NATARAJAN on FEBRUARY 7, 2011

Press the power button on your system, and after few moments you see the Linux login prompt. Have you ever wondered what happens behind the scenes from the time you press the power button until the Linux login prompt appears? The following are the 6 high level stages of a typical Linux boot process.

1. BIOS      

BIOS stands for Basic Input/Output System Performs some system integrity checks Searches, loads, and executes the boot loader program. It looks for boot loader in floppy, cd-rom, or hard drive. You can press a key (typically F12 of F2, but it depends on your system) during the BIOS startup to change the boot sequence. Once the boot loader program is detected and loaded into the memory, BIOS gives the control to it. So, in simple terms BIOS loads and executes the MBR boot loader.

2. MBR      

MBR stands for Master Boot Record. It is located in the 1st sector of the bootable disk. Typically /dev/hda, or /dev/sda MBR is less than 512 bytes in size. This has three components 1) primary boot loader info in 1st 446 bytes 2 ) partition table info in next 64 bytes 3) MBR validation check in last 2 bytes. It contains information about GRUB (or LILO in old systems). So, in simple terms MBR loads and executes the GRUB boot loader.

3. GRUB     

GRUB stands for Grand Unified Bootloader. If we have multiple kernel images installed on your system, you can choose which one to be executed. GRUB displays a splash screen, waits for few seconds, if you don’t enter anything, it loads the default kernel image as specified in the grub configuration file. GRUB has the knowledge of the filesystem (the older Linux loader LILO didn’t understand filesystem). Grub configuration file is /boot/grub/grub.conf (/etc/grub.conf is a link to this). The following is sample grub.conf of CentOS. #boot=/dev/sda default=0 timeout=5 splashimage=(hd0,0)/boot/grub/splash.xpm.gz hiddenmenu title CentOS (2.6.18-194.el5PAE) root (hd0,0) kernel /boot/vmlinuz-2.6.18-194.el5PAE ro root=LABEL=/ initrd /boot/initrd-2.6.18-194.el5PAE.img

 

As you notice from the above info, it contains kernel and initrd image. So, in simple terms GRUB just loads and executes Kernel and initrd images.

4. Kernel     

Mounts the root file system as specified in the “root=” in grub.conf Kernel executes the /sbin/init program Since init was the 1st program to be executed by Linux Kernel, it has the process id (PID) of 1. Do a ‘ps -ef | grep init’ and check the pid. initrd stands for Initial RAM Disk. initrd is used by kernel as temporary root file system until kernel is booted and the real root file system is mounted. It also contains necessary drivers compiled inside, which helps it to access the hard drive partitions, and other hardware.

5. Init  

   

Looks at the /etc/inittab file to decide the Linux run level. Following are the available run levels  0 – halt  1 – Single user mode  2 – Multiuser, without NFS  3 – Full multiuser mode  4 – unused  5 – X11  6 – reboot Init identifies the default initlevel from /etc/inittab and uses that to load all appropriate program. Execute ‘grep initdefault /etc/inittab’ on your system to identify the default run level If you want to get into trouble, you can set the default run level to 0 or 6. Since you know what 0 and 6 means, probably you might not do that. Typically you would set the default run level to either 3 or 5.

Run Level

Mode

Action

0

Halt

Shuts down system

1

Single-User Mode

Does not configure network interfaces, start daemons, or allow non-root logins

2

Multi-User Mode

Does not configure network interfaces or start daemons.

3

Multi-User Mode with Networking

Starts the system normally.

4

Undefined

Not used/User-definable

5

X11

As runlevel 3 + display manager(X)

6

Reboot

Reboots the system

6. Runlevel programs 



     

When the Linux system is booting up, you might see various services getting started. For example, it might say “starting sendmail …. OK”. Those are the runlevel programs, executed from the run level directory as defined by your run level. Depending on your default init level setting, the system will execute the programs from one of the following directories.  Run level 0 – /etc/rc.d/rc0.d/  Run level 1 – /etc/rc.d/rc1.d/  Run level 2 – /etc/rc.d/rc2.d/  Run level 3 – /etc/rc.d/rc3.d/  Run level 4 – /etc/rc.d/rc4.d/  Run level 5 – /etc/rc.d/rc5.d/  Run level 6 – /etc/rc.d/rc6.d/ Please note that there are also symbolic links available for these directory under /etc directly. So, /etc/rc0.d is linked to /etc/rc.d/rc0.d. Under the /etc/rc.d/rc*.d/ directories, you would see programs that start with S and K. Programs starts with S are used during startup. S for startup. Programs starts with K are used during shutdown. K for kill. There are numbers right next to S and K in the program names. Those are the sequence number in which the programs should be started or killed. For example, S12syslog is to start the syslog deamon, which has the sequence number of 12. S80sendmail is to start the sendmail daemon, which has the sequence number of 80. So, syslog program will be started before sendmail.

There you have it. That is what happens during the Linux boot process

RAID device is a physical grouping of disk devices in order to create a logical presentation of one device.

How You Will Check On Your Server Or System Device-mapper Is Installed Or Not? Check the following file: #cat /proc/misc if this file contains “device-mapper” term it means device mapper is installed on your system.

Related Documents


More Documents from "Huy Nguyen"