This Blog is to share our knowledge and expertise on Linux System Administration and VMware Administration

Monday, September 14, 2015

Linux Interview Questions and Answers for all - Linvirtshell

1. How to check display the status of all available services at once in Linux Server

    service --status-all

2.Where all the rpm gets installed in Linux

    /var/lib/rpm

3. what is mtab file in Linux

    It contain the detail of all the mounted file system and mount command read this 

file to genarate the o/p

4. Where all kernel message gets store

    dmesg

5. what are the thing to check if client report a performance issue on server

    Loadavg
    Memory usage
    Swap usage
    IO issue
    Intreface issue
    Check the message in var/log and in dmesg

6. Inodes are full, How to fix

    run df -i and check which FS having Inode full, Then look for number of files in that directory, huge number of small files can cause Inode issue

7. df -h shows file system is 100% full, You removed some 1 GB file but still it show the same size, what willl you do.

    #lsof | grep filesystem | grep -i deleted - if we see any files are deleted but space is not released from OS.

8. How to lock Or exclue a package from updating in patching

    # Yum versionlock package name
    # yum versionlock list
    # yum versionlock clear

9. How to scan LUNS on Linux Machine

    a. echo "---" /sys/class/scsi_host/hostX/issue_lip " double quote
    b. echo 1 > /sys/clas/fc_host/hostX/scan
    c./usr/sbin/lpfc/lun_scan all

10. How to check the WWN number for HBA

    #/sys/class/fc_host/host0/port_name | port_status
    #/usr/sbin/hbanyware/hbacmd ListHBAs |grep "Port WWN"
    #/usr/sbin/hbanayware/hbacmd portattibute "WWNnumber"

11. ow to check the HBA which you are using

    # systool -c fc_host
    # systool -c fc_host -v host3
    # lsmod | grep qla2xxx
    # lspci -nn | grep "Fibre Channel"
    # vi /usr/share/hwdata/pci.ids
    # modprobe -v qla2xxx

12. How to remove the dead path from multipath -

    # multipath -F mpath devicename. If that doesn't work then we can also make the device offline and delete manually.
    echo offline > /sys/block/$i/device/state
    echo 1 > /sys/block/$i/device/delete

13. How do you find that what are the disks are used for logical volume mirroring ?

    “lvs -a -o +devices” 

14. How to take a LVM configuration backup ?

    Use “vgcfgbackup vg_name” to take the latest configuration backup of volume group.The default volume group backup location is “/etc/lvm/backup

15. What is lvmdump ?

    “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

16. How to replace the failed hard disk in LVM ?
scenario 1 :- FRee PE are available -

    Run pvs -o+pv_used
    In above steps if there are free extent then we can move the pv with below command
    #pvmove /device/name
    vgreduce vg_name /device/name
    pvremove /device/name

scenario -2 - If there are no free extent to move the PV, and need to add a new disk OR Lun.

    Scan the lun to bring it OS control,
    Add the device to Physical volume #pvcreate /device/name
    extend the VG - #vgextend vgname /pv/devices
    run pv move and remaining steps from scenario 1

17. How to create a mirrored logical volume ?

    #lvcreate -L 1G -m1 -n lvname vgname

18. How to convert the linear volume to striped Logical volume ?

    #You can’t convert the existing linear volume or mirror volume to stripped volume due to LVM’s limitations

19. How to convert the linear volume to mirror volume ?

    #lvconvert -m1 -n lvname

20. How to extend the LV.

    If free PE available - lvextend -L +1G -name lv_name vg_name
    resize2fs /dev/vg_name/lv_name

21. How to decommission/remove LVM completely from the host ?
Answer:

    Backup the data
    Un-mount all the logical filesystems
    Remove the logical volumes using “lvremove” command.
    Destroy the volume group using “vgremove” command.
    Use “pvremove” command remove the physical volumes from the system.

22. List of important LVM related files and Directories?
## Directories

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

No comments:

Post a Comment