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

Showing posts with label Linux Interview Questions. Show all posts
Showing posts with label Linux Interview Questions. Show all posts

Thursday, September 21, 2017

Linux basics question and answer.

Thursday, September 21, 2017 0

Linux basics question and answer.

1. What is linux?
linux is a free open-source operating system based on unix. Linux is an alternative to the windows operating system. Linux was originally created by linus Torvalds. A student of the university of

Linux has a reputation as a very efficient and fast-performing system. Linux's kernel (the central part of the operating system) was developed by Linus Torvalds at the University of Helsinki in Finland. To complete the operating system, Torvalds and other team members made use of system components developed by members of the Free Software Foundation for the GNU Project.

2. What is OS?

 An operating system is a program that controls the execution of application programs and acts as an interface between the user of a computer and the computer Hardware. In other words “ THE SOFTWARE THAT CONTROLS THE HARDWARE “

3. What is open source operating system ?


 Open source refers to a program or software in which the source code (the form of the program when a programmer writes a program in a particular programming language) is available to the general public for use and/or modification from its original design free of charge.

4. What are the products of RedHat?

 Redhat enterprise linux, cloud computing, Redhat enterprise virtualization, etc.

5. What are different flavors (or distributions) of linux?


 Redhat, Turbolinux, Debian, Ubuntu, Fedora, OpenSUSE, Slackware, mandriva. Etc.

6. Who created unix?

 Ken Thompson in 1969.

7. Who founded open source foundation?

 The Free Software Foundation (FSF) is a nonprofit with a worldwide mission to promote computer user freedom and to defend the rights of all free software users.

8. What is the difference between rhel 4 and rhel 5 ?

difference between RHEL 4 and RHEL 5

1)In RHEL 4 SELinux Block only 13 services, But on RHEL 5 SElinux Block 80 services
2) RHEL 4 have ext2 filesystem, but RHEL 5 we have ext3 filesystem That support Journal
3)RHEL 4 have no virtualization Feature, but in RHEL 5 we have virtualization with Hypervisor-V
4)In RHEL 4 we have no Yum, But in RHEL 5 we have Yum available

( or )

XEN, YUM and improved SELinux
all the features updated with better options
Better GUI support then RHEL4
YUM over RPM package management
IPTables and SELinux for more secure environment

9. Difference bw tcp and udp ?

TCP(Transmission Control Protocol). TCP is a connection-oriented protocol, a connection can be made from client to server, and from then on any data can be sent along that connection.

a) Reliable - when you send a message along a TCP socket, you know it will get there unless the connection fails completely. If it gets lost along the way, the server will re-request the lost part. This means complete integrity, things don't get corrupted.
b) Ordered - if you send two messages along a connection, one after the other, you know the first message will get there first. You don't have to worry about data arriving in the wrong order.
c) Heavyweight - when the low level parts of the TCP "stream" arrive in the wrong order, resend requests have to be sent, and all the out of sequence parts have to be put back together, so requires a bit of work to piece together.

UDP(User Datagram Protocol). A simpler message-based connectionless protocol. With UDP you send messages(packets) across the network in chunks.

a) Unreliable - When you send a message, you don't know if it'll get there, it could get lost on the way.
b) Not ordered - If you send two messages out, you don't know what order they'll arrive in.
c) Lightweight - No ordering of messages, no tracking connections, etc. It's just fire and forget! This means it's a lot quicker, and the network card / OS have to do very little work to translate the data back from the packets.

10. what is kernel panic error ? how will you fix it if you have face it after rebooting without the the help of rescue disk ?

 Many of the Mac OSX or similar Unix like operating system users may face a type of error known as “Kernel Panic”. When this error message get displayed, you need to restart your system as your system stops working and require restart.Since the system is not in the state that you can perform the normal restart and therefore you need to force restart the computer. At that time if you were in the middle of theprocess or working with some kind of unsaved document thenit will also be lose.

The general causes of kernel panic in Mac OS X include:
a) Defective or incompatible RAM
b) Incompatible, obsolete or corrupted kernel extensions
c) Incompatible, obsolete or corrupted Drivers
d) Hard Disk corruption that include bad sectors,
e) directory corruption and other hard disk errors
f) Incorrect permissions on System files and folders
g) Less RAM or Hard Drive Memory
h) Defects in hardware, CPU or programming errors
i) Incompatible hardware

Other than these the Mac Kernel Panic occurs when the core component of Mac (kernel) gets an unexpected user instruction and fails to handle that instruction properly.

Kernel Panic Fix in Mac OS X

It is monitored that the kernel panic does not come frequently but if it’s occurred then restarting the computer will solve the problem but if the error occurs due to the corrupted/incompatible system resources then reinstall Mac OSX. When you go for the fresh installation of Mac OSX, the primary volume need to be formatted and all the data present over that volume will be lost. This condition can be a bad dream as you can lose lots of important data which you had saved on that system volume.

11. Expalin the process of kickstart installation?

a) Reboot the system
b) Press f12
c) Select second option cd-rom drive
d) Then enter the kickstart path: linux ks=nfs:192.168.0.41:/kickstart/workstation.cfg

12. There are 4 network Interfaces, how can we find which one is Primary.?
 When you type the command netstat -nr in your shell, you  will find a line starting with 0.0.0.0. Something like

0.0.0.0 192.168.0.4 0.0.0.0 UG 0 0 0 eth0

This line indicates if the system tries to contact a network outside its local network. It will first contact  the router 192.168.0.4 and it does it with the primary interface. Hence in this case its eth0. So you can check this line for the primary interface

13. Without Using $date -d yesterday. How I get the yesterday's date ?

 $date --date='yesterday'
$date --date='1 day ago'

14. why kerberos.............what its need?

Kerberos is a authentication protocol it is used to send data from one system to anohter in encrypted form.

Most conventional network systems use password-based authentication schemes. When a user needs to authenticate to a service running on a network server, they type in their password for each service that requires authentication. Their password is sent over the network, and the server verifies their identity using the password.

Transmission of passwords in plaintext using this method, while commonly done, is a tremendous security risk. Any system cracker with access to the network and a packet analyzer (also known as a packet sniffer) can intercept any passwords sent this way.

The primary design goal of Kerberos is to ensure that passwords are never sent across a network unencrypted and are preferably never sent over the network at all. The proper use of Kerberos will eradicate the threat of packet sniffers intercepting passwords on your network.

15. what is the use of nis server in linux? what is the purpose

The main purpose of NIS is centralizing the authentication database.

For ex:

Usually when a user try to login to the machine it will contact the passwd, shadow and group files for user’s  authentication, in case of user requires to access his/her account across the network we need to update users  information all these files in each machine in the network. It is bit tricky to organize multiple users’ info in all the machines in the network.

NIS server will act as central server for user authentication and all other machines will contact the NIS server for the user’s authentication info.
Make sure all the machines in your network should be in the same domain. NIS will work only in single domain.

16. How many minimum partitions need to install the linux?

Two minimum partition need to install the linux

1: /boot
2: /

SWAP is not mendatary to create at the time of installation it is only use for Virtual Memory purpose.... as you required when u create...


17. how is FAT32 file system mounted in linux file system?

1: mkdir /kaka
2: open vim /etc/fstab and mount it permently.
3: mount -t vfat /dev/hda1 /kaka
4: /dev/hda1...... drive name.


18. Major difference between SMB and NFS ?

 main difference between samba and nfs is - By configuring samba we can access fileS from linux to window and window to linux but by nfs can't

19. Major difference between RPM and YUM ?

the main difference of rpm and yum is that yum will install all the package including dependencies if it is present in the server. but in rpm we have to install each and every dependency ourself.

20. Command to check last runlevelwho -r



21. Is it possible to give access to a nfs share to a particular user in a particular system?

you can give permission to an ip or to the users(The usershould be from the system where the file is gettingshared,external access from users arenot allowedexcept fornfsnobody). If you want to give permission to an ip then open /etc/exports...Let /data be the shared directory: /data 10.2.1.1(ro,sync)

To give permission to a user like harry: setfacl -m u:harry:rwx /data.

By default the nfs gets accessed by the user nfsnobody. So you can add or remove a particular permissions to this user using acl.

22. In Linux OS, what is the file server?

NFS (Network File System) is the File server in Linux. We can also use the LDAP (Lightweight Direct Access Protocol)for the File server. NFS is easy to configure than LDAP. For NFS, we need the dameon portmap,nfsd etc../etc/exports is a file contains the partitions, which we want to share. NIS server which should configure for clients. we need ypbind,netfs services in clients


23.  Explain cups in linux.

 It is printer deamon

C - common
U - Unix
P - printing
S - system

24. what are pipes ? explain use of pipes ?

 a pipe is a chain of processes so that output of one process(stdoutput) is fed an input(stdinput) to another process.


25. What is the minimum number of partitions 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 your computers RAM.

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

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

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

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

30. how to recollect root password?

a) go to single user mode
b) type passwd and then the required password u want to change
c) if it gives u error on entering the passwd command
d) than type setenforce 0 it will disable the selinux for that moment and than again type the passwd command to change the password


31. what is LILO?

LILO stands for Linux boot loader. It will load the MBR, master boot record, into the memory, which tell the system which partition and hard drive to boot.

32. What is the difference between Telnet and SSH?

ssh is a secured shell, where telnet is not a secured one.when you ssh to trasnfer data between a system, the data will be send in the encrypted form, where the hacker cannot encode or decode it.

While you telnet,the data send between the system is alphabetical format(ASCII), where every one can understand. More over as per network security, telnet and ftp are prohibited. Always, trust SSL based data transfer.

33. User unable to login in server then how can u troubleshooting it? Example: server at Atlantic-DC. in that server two users try to login in server. 1st user able to login. but second user unable to login so how can troubleshoot it ?
Passwd expired r not

# usermod -l username

2)User is locked r not using the command

# passwd -u username -to unlock the user

3)passwd file problem

if any change in /etc/passwd file r /etc/shadow file

4)change the passwd

#passwd

5)The default permission for security file is 600 when the value is changed,we can't login

#ls -ld /etc/secur


34. Explain linux file types?

7 types of files

- regular
d directory
l symbolic link
c character special file (hardware files)
b block special file (files to communicate with hardware)
p named pipe (to pass data between process )
s socket ( mechanism for inter-process communication

35. Please explain the file structure of linux?
The Linux system contains thousand of files located within many directories. All directories are organized in a tree-structure like manner.
* The 'trunk' of the tree is the root directory.
* The root directory is simply identified as a "/".
* All other directories 'branch' off from the trunk.

The following lists the most common directories and their intended contents.

* / - root directory
* /home - where directories are contained for each user,
example:
* /usr - pronounced 'user' and contains Linux commands and utilities
o /bin - binary executable programs
o /lib - program libraries, similar to Windows 'dll' files
o /sbin - more executable programs and Linux utilities for administrative purposes
o /doc - documentation
o /src - source code to programs
* /tmp - temporary work files
* /etc - configuration files
o /rc.d - scripts used during boot and shutdown process
o /sysconfig - default configuration files
o /sysconfig/network-scripts - network scripts
o /sysconfig/daemons - special programs that run in background, such as print spooling
* /bin - binary executable programs that all users need
* /dev - device files that control drives, terminals andany equipment attached to the server
* /var - user specific files
o /log - log files containing system usage and errors
o /spool - where spooled files are stored during print spooling process
o /mail - where Email files are stored until retrieved by client Email program
* /proc - system files
* /root - root's home directory
* /opt - other options
* /sbin - more executable programs and utilities


36. Can we open pdf files in suse?

We can open .pdf file with the help of CUPS-PDF package.
Install CUPS-PDF package and use pdf file.

37. Why you shouldn’t use the root login?


Root has full control over the system Its like Admin.There ll be full credentials for root.If deleted any datas as root login its difficult to recover.

38. Who owns data dictionary?

The SYS user owns the data dictionary. The SYS and SYSTEM users are created when the database is created.

Very Basic Linux interview Questions and Answers - Linvirtshell

Thursday, September 21, 2017 0
1. Command to list the files in a directory?

ls - list directory contents
ls -l (-l use a long listing format)

2. Command to list all the files in a directory, including the hidden files?


ls -a (-a, do not hide entries starting with .)

3. Command to find out all processes that are currently running?


 ps -f (-f does full-format listing.)

4. Command to find out the processes that are currently running or a particular user?


ps -au Myname (-u by effective user ID (supports names)) (a - all users)

5. Command to kill a particular process?


kill -9 23456 (process_id 23456) or kill -9 %8765 (job number 8765)
kill -9 -1 (Kill all processes you can kill.)
killall - kill processes by name most (useful - killall java)


6. Commands to view the contents of the file?


less filename
cat filename
more filename   
tail filename       -  can see the end of the file.
head filename    - can see the head of the file
vi filename
vim filename


7. Commands to use edit contents of the file?


vi  filename
vim  filename
nano filename
view  filename
visudo — edit the sudoers file


8. Command to view contents of a large log file?


tailf /var/log/messages ( last 10 rows)
less filename
head /var/log/messages  (first 10 rows)

9. How do you log in to a remote Unix box?


ssh  remote_server — OpenSSH SSH client (remote login program)


10.How do you get help on a UNIX terminal?


man command_name
info command_name (more information)

11.Command to list contents of a directory including all of its

subdirectories, providing full details and sorted by modification time?
ls -acl  filename
-a    all entries
-c    by time
-l     use a long listing format

12.How do you create a symbolic link to a file (give some reasons of doing so)?


ln - make links between files

Links create pointers to the actual files, without duplicating the contents of
the files. That is, a link is a way of providing another name to the same file.
There are two types of links to a file.

a.Hard link
b.Symbolic (or soft) link

13. What is a filesystem?


Sum of all directories called file system.
A file system is the primary means of file storage in UNIX.
File systems are made of inodes and superblocks.

14. Command to get file system usage?


df - report file system disk space usage.

15. How do you check the sizes of all users home directories (one command)?


du -sh /home/

du command summarize disk usage of each FILE, recursively for directories.

Wednesday, September 6, 2017

Linux Interview Questions and Answers for fresher and senior - Linvirtshell

Wednesday, September 06, 2017 0
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

Monday, September 14, 2015

Basic Linux Interview Questions and Answers - Linvirtshell

Monday, September 14, 2015 0
1. Explain in detail the Linux booting procedure
  • When a Linux machine is powered on BIOS loads up first.
  • It will prompt you to select boot device which can be Hard disk, CD-ROM, Floppy drive, Network etc.
  • By default generally it will boot with hard disk Next comes your MBR.
  • This will load and execute the GRUB boot loader menu.
  • GRUB stands for Grand Unified Boot Loader.
  • This will display the a splash screen with the contents of /boot/grub/grub.conf.
  • List of available and installed kernels will be shown, if not selected default kernel will be loaded
  • Kernel: Mounts the root files system as specified by "root=" parameter inside /boot/grub/grub.conf file
  • Next it will execute /sbin/init program which will boot the linux machine in the default run level as specified by /etc/inittab
  • Runlevel: All the scripts loaded inside the selected runlevel from step 5 will be executed These scripts are placed inside /etc/rc.d/rcx.d/. Here x is the runlevel value which will be varying from 0-6
  • Scripts starting from S would load at startup and those starting with K would kill the process at shutdown.
  • These incident will take place as per the numerical value assigned to them. For eg: s13network will load prior than s15 sendmail
  • Next your login screen will come up
2. What is the difference between soft link and hard link?
    Soft Link

  • Using this only a link to the original file is created (shortcut).
  • The size of created shortcut is null.
  • If you delete the file then the created link (shortcut) won't work.
  • In case you delete the shortcut link then it won't affect the original file
    Hard Link
  • Another copy of the file is created.
  • Both the file have same inode no.
  • Any changes made in either of the file will appear on the other file.
  • Deleting any of the one file won't affect the other file.
3. How to find the bit size of your Linux machine?
    # uname -m
    # getconf LONG_BIT

4. How can you add a banner or login message in Linux?
By editing these two files

    /etc/issue
    /etc/motd

5. How will you check the release version of your Linux machine?
    # cat /etc/redhat-release

6. What is the difference between normal kernel and kernel-PAE?
    kernel in 32 bit machine supports max of 4 GB RAM whereas
    kernel PAE in 32 bit linux machine supports till 64 GB RAM

7. Tell me the command to find all the commands in your linux machine having only 2 words like ls, cp, cd etc.
    # find /bin /sbin/usr/bin /usr/sbin -name ?? -type f

8. Which file is generally used to configure kickstart?
    anaconda.cfg

9. What is the command use to compress a dir using gzip compression?
    # tar -czvf myfil.tar.gzip orig_file

10. What is the command use to compress a dir using bzip2 compression?
    # tar -cjvf myfil.tar.bzip2 orig_file

11. Which log file will you check for all authentication related messages?
    /var/log/secure

12. What is the command to create multiple directories using one command?
      Using -p argument along with mkdir command

13. What is the command used to find the process responsible for a particular running file?
      # fuser -m filename
      # lsof filename

14. What are the three values shown in load average section of top command?
       It shows the current, 5 min back and 15 min back load average value

15. How to check all the process running by a particular user?
        # ps -u username

16. What is an orphan process?
       An orphan process is a process that is still executing, but whose parent has died.

17. How to remove the package without checking the dependencies on Redhat Linux ?
      rpm -ev –nodeps package_name

18. What is the command in sar to monitor NIC devices received/transmitted packets?
      # sar -n DEV 1 5

19. How to enable SAR command to store data for more then a month?
      #/etc/sysconfig/sysstat - Here change the History = 30 days and sar will start storing the data for months.

20. What is ACL?

    #Requiremnet to use ACL - A file system should be mounted with ACL option.
    #ACL allows us to give permssion to someone without change the actual permission of   the file.
    # setfacl -m file:rwx -u User

21. How to allow specfic user to login via SSH?
    #AllowUsers anze dasa kimy in /etc/sshd/ssh.conf

22. how to create a new partition and add to swap?
    #create new parttion with fdisk and mark the partition type as 83
    #mkswap /dev/sdaX
    #swapon /dev/sdaX

23. How to get the list of dependencies for specific rpm file ?
    rpm -qpR rpm_file

24. How to get the list of dependencies for specific package ?
    rpm -qR package_name 

Linux Interview Questions and Answers for Freshers - Linvirtshell

Monday, September 14, 2015 0
1. What is Network Bonding ?

    Network bonding is the aggregation of multiple Lan cards into a single bonded interface to provide fault toleranceand high performance.
    Network bonding is also known as NIC Teaming

2. Mention all the network configuration files you would check to configure your ethernet card

    /etc/sysconfig/network-scripts/ifcfg-eth*
    /etc/sysconfig/network
    /etc/resolv.conf
    /etc/nsswitch.conf

3. How to change the ethernet card setting

    ethtool -s ethX speed 1000 duplex full

4. What does the last two sections define in fstab file?

    The 5th column tells the dump information if whether the partition has to be backed up. It it is "0" the filesystem will be ignored.
    The 6th column tells the order in which fsck command would check the filesystem on boot. If it is "0" then fsck won't check the filesystem.

5. How to add & change the Kernel parameters ?

    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.

6. What is the difference between TCP and UDP protocol?

    TCP is a connection oriented protocol and contain the information of sender as well as receiver.

Eg: HTTP.FTP, Telnet

TCP is slower than UDP due to its error checking mechanism

    UDP protocols are connection less packets have no information to where they are going. These type of ports are generally used for broadcasting.For eg: DNS, DHCPUDP are faster

7. What are the possible ways to check if your system is listening to port 67

# fuser -v -n tcp 67
# cat < /dev/tcp/localhost/67
# ssh -vv localhost:67
# lsof -i :67
# nmap localhost | grep 67
# netstat -ntlp | grep 67
# telnet localhost 67

8. What is umask?

    In computing, umask is a command that determines the settings of a mask that controls which file permissions are set for files and directories when they are created. It also refers to a function that sets the mask, and to the mask itself,
    which is formally known as the file mode creation mask.

9. What is the default umask value for useradd command and where is it defined?

    Default umask value for useradd: 077
    /etc/login.defs

10. Will you be able to cd into a directory with only read permission?

    No, we need execute permission along with read to cd into directory

11. What is -R argument used for along with chmod command?

    To recursively apply the permission to all the directories including sub directories and files

12. How can you restrict a normal as well as root user from making any changes as well as deleting any file?

    chattr command

13. How do you give acl in Linux?

    Give individual permission using setfacl

Redhat Cluster Interview Questions and Answers - Linvirtshell

Monday, September 14, 2015 2
1. How to freeze a service in cluster node
    #clusvcadm -Z service name

2. What is CMAN

  • Basically, cluster manager is a component of the cluster project that handles communications between nodes in the cluster.
  • CMAN is Cluster Manager. It manages cluster quorum and cluster membership.
  • CMAN runs on each node of a cluster
3. What is RGManager
  • RGManager manages and provides failover capabilities for collections of cluster resources called services, resource groups, or resource trees.
  • In the event of a node failure, RGManager will relocate the clustered service to another node with minimal service disruption. You can also restrict services to certain nodes, such as restricting httpd to one group of nodes while mysql can be restricted to a separate set of nodes.
  • When the cluster membership changes, openais tells the cluster that it needs to recheck it’s resources. This causes rgmanager, the resource group manager, to run. It will examine what changed and then will start, stop, migrate or recover cluster resources as needed.
  • Within rgmanager, one or more resources are brought together as a service. This service is then optionally assigned to a failover domain, an subset of nodes that can have preferential ordering.
4. What is Cluster Quorum
  • Quorum is a voting algorithm used by CMAN.
  • CMAN keeps a track of cluster quorum by monitoring the count of number of nodes  in cluster.
  • If more than half of members of a cluster are in active state, the cluster is said to be in Quorum
  • If half or less than half of the members are not active, the cluster is said to be down and all cluster activities will be stopped Quorum is defined as the minimum set of hosts required in order to provide service and is used to prevent split-brain situations.
  • The quorum algorithm used by the RHCS cluster is called “simple majority quorum”, which means that more than half of the hosts must be online and communicating in order to provide service.
5. What is split-brain
  • It is a condition where two instances of the same cluster are running and trying to access same resource at the same time, resulting in corrupted cluster integrity Cluster must maintain quorum to prevent split-brain issues.
  • It's necessary for a cluster to maintain quorum to prevent 'split-brain' problems. If we didn't enforce quorum, a communication error on that same thirteen-node cluster may cause a situation where six nodes are operating on the shared disk, and another six were also operating on it,independently.
  • Because of the communication error, the two partial-clusters would overwrite areas of the disk and corrupt the file system.
  • With quorum rules enforced, only one of the partial clusters can use the shared storage, thus protecting data integrity.Quorum doesn't prevent split-brain situations, but it does decide who is dominant and allowed to function in the cluster. Should split-brain occur, quorum prevents more than one cluster group from doing anything.
6. What is FencingFencing is the disconnection of a node from the cluster’s shared storage. Fencing cuts off I/O from shared storage, thus ensuring data integrity.
  The cluster infrastructure performs fencing through the fence daemon, fenced.

  • Power fencing — A fencing method that uses a power controller to power off an inoperable node.
  • Storage fencing — A fencing method that disables the Fibre Channel port that connects storage to an inoperable node.
  • Other fencing — Several other fencing methods that disable I/O or power of an inoperable node, including IBM Bladecenters, PAP, DRAC/MC, HP ILO, IPMI, IBM RSA II, and others.
7. What can cause a node to leave the cluster?
      A node may leave the cluster for many reasons. Among them:
  • Shutdown: cman_tool leave was run on this node
  • Killed by another node. The node was killed with either by cman_tool kill or qdisk.
  • Panic: cman failed to allocate memory for a critical data structure or some other very bad internal failure.
  • Removed: Like 1, but the remainder of the cluster can adjust quorum downwards to keep working.
  • Membership Rejected: The node attempted to join a cluster but it's cluster.conf file did not match that of the other nodes. To find the real reason for this you need to examine the syslog of all the valid cluster members to find out why it was rejected.
  • Inconsistent cluster view: This is usually indicative of a bug but it can also happen if the network is extremely unreliable.
  • Missed too many heartbeats: This means what it says. All nodes are expected to broadcast a heartbeat every 5 seconds (by default). If none is received within
8. How can I define a two-node cluster if a majority is needed to reach quorum?
       We had to allow two-node clusters, so we made a special exception to the quorum rules. There is a special setting"two_node" in the /etc/cluster.conf file that looks like this:<cman expected_votes="1" two_node="1"/>

9. How can you define a cluster and what are its basic types?

       A cluster is two or more computers (called nodes or members) that work together to     perform a task. There are four major types of clusters:Storage
        High availability
        Load balancing
        High performance.

10. What is Storage Cluster?

  • Storage clusters provide a consistent file system image across servers in a cluster, allowing the servers to simultaneously read and write to a single shared file system.
  • Storage cluster simplifies storage administration by limiting the installation and patching of applications to one filesystem.
  • The High Availability Add-On provides storage clustering in conjunction with Red Hat GFS2
11. What is High Availability Cluster?
  • High availability clusters provide highly available services by eliminating single points of failure and by failing over services from one cluster node to another in case a node becomes inoperative.
  • Typically, services in a high availability cluster read and write data (via read-write mounted file systems).
  • A high availability cluster must maintain data integrity as one cluster node takes over control of a service from another cluster node.
  • Node failures in a high availability cluster are not visible from clients outside the cluster.
  • High availability clusters are sometimes referred to as failover clusters.
12. What is Load Balancing Cluster?
  • Load-balancing clusters dispatch network service requests to multiple cluster nodes to balance the request load among the cluster nodes.
  • Load balancing provides cost-effective scalability because you can match the number of nodes according to load requirements. If a node in a load-balancing cluster becomes inoperative, the load-balancing software detects the failure and redirects requests to other cluster nodes.
  • Node failures in a load-balancing cluster are not visible from clients outside the cluster.
  • Load balancing is available with the Load Balancer Add-On.
13. What is a High Performance Cluster?
  • High-performance clusters use cluster nodes to perform concurrent calculations.
  • A high-performance cluster allows applications to work in parallel, therefore enhancing the performance of the applications.
  • High performance clusters are also referred to as computational clusters or grid computing.
14. How many nodes are supported in Red hat 6 Cluster?
     A cluster configured with qdiskd supports a maximum of 16 nodes. The reason for the limit is because of scalability; increasing the node count increases the amount of synchronous I/O contention on the shared quorum disk device

15. What is the minimum size of the Quorum Disk?                                                            
    The minimum size of the block device is 10 Megabytes.

16. What is the order in which you will start the Red Hat Cluster services?
In Red Hat 4
    service ccsd start
    service cman start
    service fenced start
    service clvmd start (If CLVM has been used to create clustered volumes)
    service gfs start
    service rgmanager start
In RedHat 5
    service cman start
    service clvmd start
    service gfs start
    service rgmanager start
In Red Hat 6
    service cman start
    service clvmd start
    service gfs2 start
    service rgmanager start

17. What is the order to stop the Red Hat Cluster services?
In Red Hat 4
    service rgmanager stop
    service gfs stop
    service clvmd stop
    service fenced stop
    service cman stop
    service ccsd stop
In Red Hat 5
    service rgmanager stop
    service gfs stop
    service clvmd stop
    service cman stop
In Red Hat 6
    service rgmanager stop
    service gfs2 stop
    service clvmd stop
    service cman stop

18.What are the lock states in Red Hat Cluster?

     A lock state indicates the current status of a lock request. A lock is always in one of three states:
  • Granted — The lock request succeeded and attained the requested mode.
  • Converting — A client attempted to change the lock mode and the new mode is incompatible with an existing lock.
  • Blocked — The request for a new lock could not be granted because conflicting locks exist.
    A lock's state is determined by its requested mode and the modes of the other locks on the same resource.

19. What is the maximum file system support size for GFS2?

  • GFS2 is based on 64 bit architecture, which can theoretically accommodate an 8 EB file system.
  • However, the current supported maximum size of a GFS2 file system for 64-bit hardware is 100 TB.
  • The current supported maximum size of a GFS2 file system for 32-bit hardware for Red Hat Enterprise Linux Release
20. What is the journalling file system?
  • A journalling file system is a file system that maintains a special file called a journal that is used to repair any inconsistencies that occur as the result of an improper shutdown of a computer.
  • In journalling file systems, every time GFS2 writes meta data, the meta data is committed to the journal before it is put into place.
  • This ensures that if the system crashes or loses power, you will recover all of the meta data when the journal is automatically replayed at mount time.
    GFS2 requires one journal for each node in the cluster that needs to mount the file system. For example, if you have a 16-node cluster but need to mount only the file system from two nodes, you need only two journals. If you need to mount from a third node, you can always add a journal with the gfs2_jadd command.5.3 and later is 16 TB.

     NOTE: It is better to have 10 1TB file systems than one 10TB file system.

21. What is the default size of journals in GFS?

  • When you run mkfs.gfs2 without the size attribut for journal to create a GFS2 partition, by default a 128MB size journal is created which is enough for most of the applications.
  • In case you plan on reducing the size of the journal, it can severely affect the performance.
  • Suppose you reduce the size of the journal to 32MB it does not take much file system activity to fill an 32MB journal, and when the journal is full, performance slows because GFS2 has to wait for writes to the storage.
22.  What is DLM lock model?
  • DLM is a short abbreviation for Distributed Lock Manager.
  • A lock manager is a traffic cop who controls access to resources in the cluster, such as access to a GFS file system.
  • GFS2 uses locks from the lock manager to synchronize access to file system metadata (on shared storage) CLVM uses locks from the lock manager to synchronize updates to LVM volumes and volume groups (also on shared storage)
  • In addition, rgmanager uses DLM to synchronize service states.
  • without a lock manager, there would be no control over access to your shared storage, and the nodes in the cluster would corrupt each other's data.
23. What is rgmanager in Red Hat Cluster and its use?
  • This is a service termed as Resource Group Manager
  • RGManager manages and provides failover capabilities for collections of cluster resources called services, resource groups, or resource trees it allows administrators to define, configure, and monitor cluster services.
  • In the event of a node failure, rgmanager will relocate the clustered service to another node with minimal service disruption
24. What is luci and ricci in Red Hat Cluster?
  • Luci is the server component of the Conga administration utility
  • Conga is an integrated set of software components that provides centralized configuration and management of Red Hat clusters and storage
  • Luci is a server that runs on one computer and communicates with multiple clusters and computers via ricci.
  • Ricci is the client component of the Conga administration utilityricci is an agent that runs on each computer (either a cluster member or a standalone computer) managed by CongaThis service needs to be running on all the client nodes of the cluster.
25. What is cman in Red Hat Cluster?
  • This is an abbreviation used for Cluster Manager.
  • CMAN is a distributed cluster manager and runs in each cluster node.
  • It is responsible for monitoring, heartbeat, quorum, voting and communication between cluster nodes.
  • CMAN keeps track of cluster quorum by monitoring the count of cluster nodes.
26. What are the different port no. used in Red Hat Cluster?
    IP Port No     Protocol         Component
    5404,5405     UDP              corosync/cman
    11111             TCP               ricci
    21064            TCP               dlm (Distributed Lock Manager)
    16851            TCP               Modclustered
    8084              TCP               luci4196,4197    TCP               rgmanager

27. How does NetworkManager service affects Red Hat Cluster?
     The use of NetworkManager is not supported on cluster nodes. If you have installed NetworkManager on your cluster nodes, you should either remove it or disable it.
     # service NetworkManager stop
     # chkconfig NetworkManager off
The cman service will not start if NetworkManager is either running or has been configured to run with the chkconfig command

28. What is the command used to relocate a service to another node?
    clusvcadm -r service_name -m node_name

Linux Interview Questions and Answers for all - Linvirtshell

Monday, September 14, 2015 0
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