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

Wednesday, September 6, 2017

Linux Interview Questions and Answers for fresher and senior - Linvirtshell

1. what is the maximum number of partitions that can be made on a hard drive?

 In a hard disk we can create 4 primary partitions or alternatively 3 primary partitions and an extended partition. 

The primary+extended partition can be divided into 63 logical partitions  ( Also it depends on the MBR table size)



2. How to extend the lvm with physical extent?

Free PE / Size 952 / 3.72 GB
In this case use Free PE # 952 ,this will assign the entire disk 3.72 GB, use -l and + sign.


#sudo lvextend -l +952 /dev/vol_grp1/logical_vol1


Also resize the file system resize2fs after extending the lvm


3. how to pass sudo password in shell script? 

echo "password" | su - -c "cp -pr /boot/ /home/nsk/"

4. How to Update an A record from Command Line in DNS? 

 It should be run an authoritive name server.

Edit the zone file with your favorite command line editor. In this example, we use ‘vi’.


[root@host /var/named/]% vi /var/named/example.com.db
Locate the appropriate line and update the up address. You will see something like the following:
ftp IN A 192.168.1.100
Update the Zone’s Serial number.
Make BIND aware of your DNS changes by reloading the DNS zone.


[root@host /var/named/]% rndc reload example.com


Test that your changes worked correctly using ‘dig’.
[root@host /var/named/]% dig @localhost ftp.example.com


5. What are the types of DNS servers available?

a. Master
b. Slavec. 
c. Caching only DNS server
d. Forwarding only DNS server

6. DNS default & Main configuration file.

Main configuration file for dns server is named.conf. By default this file is not created in /var/named/chroot/etc/ directory. Instead of named.conf a sample file /var/named/chroot/etc/named.caching-nameserver.conf is created. This file is use to make a caching only name server. You can also do editing in this file after changing its name to named.conf to configure master dns server or you can manually create a new named.conf file

We are using bind's chroot features so all our necessary files will be located in chroot directory. Set directory location to /var/named. Further we will set the location of forward zone and reverse lookup zone files. If you cannot create this file manually then download this file and copy to /var/named/chroot/etc/

We have defined two zone files example.com.zone for forward zone and 0.168.192.in-addr.arpa for reverse zone. These files will be store in /var/named/chroot/var/named/ location. We will use two sample files for creating these files.


7. what is the difference between yum update and yum upgrade?

yum upgrade and yum update will perform the same function that update to the latest current version of package.

But the difference is Upgrade will delete obsolete packages, while update will preserve them.


8. Explain the yum erase and yum remove.


yum erase : Remove all the rpms and keep the config file
yum remove : Remove all the file.


9. How to set up a SAN boot LUN on LInux.


We can set up a SAN boot LUN to work in a Red Hat Enterprise Linux environment that is using the FC protocol.

Before you begin verify that your system setup supports SAN boot LUNs. See the Interoperability Matrix.

Steps
Create a LUN on the storage system and map it to the host. This LUN will be the SAN boot LUN.
You should ensure the following:
a. The SAN boot LUN is mapped to the host.
b. Multiple paths to the LUN are available.
c. The LUN is visible to the host during the boot process.
d. Enable the BIOS of the HBA port to which the SAN boot LUN is mapped.
For information about how to enable the HBA BIOS, see your HBA vendor-specific documentation.
e. Configure the paths to the HBA boot BIOS as primary, secondary, tertiary, and so on, on the boot device.
For more information, see your vendor-specific documentation.
f. Save and exit.
g. Reboot the host.
h. Install the operating system on the SAN boot LUN.
Note: For Red Hat Enterprise Linux 5 series, you must specify Boot Option as linux mpath during the operating system installation. When you specify linux mpath, you can see the multipath devices (/dev/mapper/mpathx) as installation devices.
i. Install the Host Utilities.
j. Configure DM-Multipath.


10. How to create GFS file system.


mkfs.gfs2 -p LockProtoName -t clustername:clusterfilesystem -j NumberJournals BlockDevice
mkfs.gfs2 -p lock_dlm -t alpha:mydata1 -j 8 /dev/vg01/lvol0


11. How to extend the GFS file system

gfs2_grow /mygfs2fs


12. How to repair GFS file system
fsck.gfs2 -y /dev/testvg/testlv


13. How to add journal to a file systemgfs2_tool journals /mnt/gfs2      : find out how many journals the GFS2 file system currently contains

gfs2_jadd -j1 /mygfs2  


14. Is my hard drive is dying?   How to check?


check hard disk for errors using smartctl command
smartctl -a /dev/sda


15. Find out the largest directories or files eating disk space on a Unix-like systesm:

#du -a /ftpusers/tmp | sort -n -r | head -n 10


#du -cks * | sort -rn | head

No comments:

Post a Comment