Interview Questions

1: 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.

2: What does Sar provides and at which location Sar logs are stored ?

Ans: Sar Collect, report, or save system activity information. The default version of the sar command (CPU utilization report) might be one of the first facilities the user runs to begin system activity investigation, because it monitors major system resources. If CPU utilization is near 100 percent (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 the dd parameter indicates the current day.

3: 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

4: 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.

5: 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.

6: 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.

7: 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.

8: 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.

9: 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.

10:1 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.
Naturally you’d have installed nfs related packages, chkconfig’d them and started them as services

11: 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.

For more questions please reach out to us as we will prepare you with many of these