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

Friday, September 25, 2015

How to setup Local Repository Server from Disk image - Linvirtshell

Friday, September 25, 2015 0
Setup Local Repository Server from Disk image

1.First mount the OS image on server

# mount /dev/cdrom /mnt

2. Copy all the content to local directory

# cp -avf /mnt/* /var/ftp/pub/

3. Watch the size of /var/ftp/pub/ 

#watch du -h /var/ftp/pub

4. Un mount the image

#umount /mnt

5. Copy the grouping files to /root

# cp /var/ftp/pub/Server/repodata/comps-rhel5-server-core.xml /root
# cp /var/ftp/pub/VT/repodata/comps-rhel5-vt.xml /root

6. Remove the group files

# rm -rf /var/ftp/pub/Server/repodata
# rm -rf /var/ftp/pub/VT/repodata

7. Create new group Repository file

# createrepo -g /root/comps-rhel5-Server-core.xml -v /var/ftp/pub/Server
# createrepo -g /root/comps-rhel5-VT.xml -v /var/ftp/pub/VT

8. Remove the default repository files

# rm -rf /etc/yum.repos.d/*

9. Create new repository file (in server)

# vi /etc/yum.repos.d/server-repo

[Server]

name = RHEL SERVER
baseurl = file:///var/ftp/pub/Server
enabled = 1
gpgcheck =0

[VT]

name = RHEL VT
baseurl = file:///var/ftp/pub/VT
enabled = 1
gpgcheck = 0

10. Start the ftp service
#service vsftpd restart

Client Configuration

# vi /etc/yum.repos.d/client.repo

[Server]
name= Client Repo
baseurl = ftp://serverip/pub/Server
enabled = 1
gpgcheck = 0

[VT]
name= Client Repo
baseurl = ftp://serverip/pub/VT
enabled = 1
gpgcheck = 0

  Save and close the config. Run the below command for checking

#yum clean all
#yum list all

Wednesday, September 23, 2015

How to configure Software Raid on Linux?

Wednesday, September 23, 2015 0
Software RAID is one of the greatest feature in Linux to protect the data from disk failure.We have LVM also in Linux to configure mirrored volumes but Software RAID  recovery is much easier in disk failures compare to Linux LVM. I have seen some of the environments are configured with Software RAID and LVM (Volume groups are built using RAID devices).
Using simple md commands, we can easily add and remove the disks from RAID.

Supported Software RAID Configurations on Linux

RAID level      Description                                                    Linux Option
RAID 0           Stripping                                                    “–level=0 –raid-devices=3”
RAID 1           Mirroring                                                    “–level=mirror –raid-devices=2 “
RAID 5           Stripping with Distributed Parity.               “–level=5 –raid-devices=3”
RAID 6           Stripping with Distributed Double Parity    “–level=6 –raid-devices=4”
RAID 10         Mirrored Stripe.                                          “–level=10 –raid-devices=4”

Available Disks for configuring software RAID.
/dev/sdb
/dev/sdc

1.Label the disk with Software RAID tag:
Before configuring the software RAID,you have to label the disk properly using fdisk command.So that you can easily identify which disks are in RAID and ioctl can read the disk properly.
[root@Test ~]# fdisk /dev/sdb

Create New Partition (n) with Primary (P) Select the size. Set the code fd for software raid and save the configuration
Perform the same for disk /dev/sdc as well. 

Run Partprobe command

2.Verify the both disk flag status using fdisk command.
[root@Test ~]# fdisk -l /dev/sdb /dev/sdc

3.Configure the desired RAID level.Here i am configuring RAID 1.
[root@Test ~]# mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sdb1 /dev/sdc1

4.Create filesystem on md device and mount it.Do not forget to add the device details in
/etc/fstab to mount the volume across the system reboot.
[root@Test ~]# mkfs.ext4 /dev/md0
[root@Test ~]# mkdir /Test1
[root@Test ~]# mount /dev/md0 /Test1/
[root@Test ~]# df -h /Test1/

5.If you want to use md device on LVM, then skip “step 4” and continue from here.
You can add the logical volume details in /etc/fstab to mount the volume across the reboots.
[root@Test ~]# pvcreate /dev/md0
[root@Test ~]# pvs
[root@Test ~]# vgcreate raidvg /dev/md0
[root@Test ~]# lvcreate -L 200M -n lvdata raidvg
[root@Test ~]# lvs |grep lvdata

[root@Test ~]# mkfs.ext4 /dev/raidvg/lvdata
[root@Test ~]# mount /dev/raidvg/lvdata /Test1
[root@Test ~]# df -h /Test1


6. Check the raid status
[root@Test ~]# cat /proc/mdstat

7. mdadm configuration file is /etc/mdadm.conf


8. You have to update mdadm.conf with newly configured RAID information using below method
[root@Test ~]# mdadm --examine --scan
[root@Test ~]# mdadm --examine --scan >> /etc/mdadm.conf
[root@Test ~]# cat /etc/mdadm.conf

9.To see Configured RAID information,use below commands.
[root@Test ~]# mdadm --query /dev/md0
[root@Test ~]# mdadm --detail /dev/md0

10. If you want remove the software RAID, use the below methods.First stop the RAID using madadm command.Once its stopped ,you can remove the super block to destroy complete RAID configuration from the configured disks.

[root@Test ~]# mdadm --stop /dev/md0
[root@Test ~]# mdadm --query /dev/md0
[root@Test ~]# mdadm --zero-superblock /dev/sdb1
[root@Test ~]# mdadm --zero-superblock /dev/sdc1
[root@Test ~]# watch cat /proc/mdstat

Friday, September 18, 2015

How to scan a new LUN added to Redhat linux server

Friday, September 18, 2015 0
Scan the new LUN in RHEL server.

Here echo command is used scan the newly added LUN in Linux server (RHEL)

SCSI_HOST

# echo "- - -" > /sys/class/scsi_host/hostx/scan

or

# echo "c t l" >  /sys/class/scsi_host/hostx/scan

FC_HOST

# echo "1" > /sys/class/fc_host/hostX/issue_lip
# echo "- - -" > /sys/class/scsi_host/hostx/scan

c   - channel on the HBA,
t   - SCSI target ID  ,
l   - LUN 
x   - HBA number

Hope it helps.

How to download a large file on a Linux Server or Desktop?

Friday, September 18, 2015 0
Run wget In Background For Downloading Files on a Linux Server or Desktop

Syntax
wget -bqc http://path-to-url/linux.iso

You will see a PID on screen:

-b: Go to background immediately after start up. If no output file is specified via the -o, output is redirected to wget-log.
-q : Turn off Wget’s output and save disk space.
-c : Resume broken download i.e. continue getting a partially-downloaded file. This is useful when you want to finish up a
download started by a previous instance of Wget, or by another program.

This tip will save your time while downloading large ISO file or any other files from the Internet

The nohup command

You can also use the nohup command to execute commands after you exit from a shell prompt. The syntax is:
$ nohup wget -qc http://path-to-url/linux.iso &
$ exit

Tuesday, September 15, 2015

RHEL: Linux Bonding / Teaming Multiple Network Interfaces (NIC) Into a Single Interface

Tuesday, September 15, 2015 0
Step #1: Create a Bond0 Configuration File

Red Hat Enterprise Linux (and CentOS) stores network configuration in /etc/sysconfig/network-scripts/ directory.
First, you need to create a bond0 config file as follows:

# vi /etc/sysconfig/network-scripts/ifcfg-bond0

Append the following linest:
DEVICE=bond0
IPADDR=192.168.1.20
NETWORK=192.168.1.0
NETMASK=255.255.255.0
USERCTL=no
BOOTPROTO=none
ONBOOT=yes

Replace IP address with your actual setup. Save and close the file.

Step #2: Modify eth0 and eth1 config files Open both configuration using a text editor such as vi/vim, and make sure file read as follows for eth0 interface

# vi /etc/sysconfig/network-scripts/ifcfg-eth0

Modify/append directive as follows:
DEVICE=eth0
USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none

Open eth1 configuration file using vi text editor, enter:

# vi /etc/sysconfig/network-scripts/ifcfg-eth1

Make sure file read as follows for eth1 interface:
DEVICE=eth1
USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none

Save and close the file.

Step # 3: Load bond driver/module

Make sure bonding module is loaded when the channel-bonding interface (bond0) is brought up. Modify kernel modules configuration file:

# vi /etc/modprobe.conf

Append following two lines:
alias bond0 bonding
options bond0 mode=balance-alb miimon=100

 **********************************************************

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

************************************************************

Save file and exit to shell prompt. You can learn more about all bounding options by clicking here).

Step # 4: Test configuration

First, load the bonding module, enter:
# modprobe bonding

Restart the networking service in order to bring up bond0 interface, enter:
# service network restart

Make sure everything is working. Type the following cat command to query the current status of Linux kernel bounding driver, enter:

# cat /proc/net/bonding/bond0

Sample outputs:

Bonding Mode: load balancing (round-robin)
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 200
Down Delay (ms): 200
Slave Interface: eth0
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:0c:29:c6:be:59
Slave Interface: eth1
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:0c:29:c6:be:63

To list all network interfaces, enter:
# ifconfig

Sample outputs:

bond0     Link encap:Ethernet  HWaddr 00:0C:29:C6:BE:59
 inet addr:192.168.1.20  Bcast:192.168.1.255  Mask:255.255.255.0
 inet6 addr: fe80::200:ff:fe00:0/64 Scope:Link
 UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1
 RX packets:2804 errors:0 dropped:0 overruns:0 frame:0
 TX packets:1879 errors:0 dropped:0 overruns:0 carrier:0
 collisions:0 txqueuelen:0
 RX bytes:250825 (244.9 KiB)  TX bytes:244683 (238.9 KiB)
eth0      Link encap:Ethernet  HWaddr 00:0C:29:C6:BE:59
 inet addr:192.168.1.20  Bcast:192.168.1.255  Mask:255.255.255.0
 inet6 addr: fe80::20c:29ff:fec6:be59/64 Scope:Link
 UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1
 RX packets:2809 errors:0 dropped:0 overruns:0 frame:0
 TX packets:1390 errors:0 dropped:0 overruns:0 carrier:0
 collisions:0 txqueuelen:1000
 RX bytes:251161 (245.2 KiB)  TX bytes:180289 (176.0 KiB)
 Interrupt:11 Base address:0x1400
eth1      Link encap:Ethernet  HWaddr 00:0C:29:C6:BE:59
 inet addr:192.168.1.20  Bcast:192.168.1.255  Mask:255.255.255.0
 inet6 addr: fe80::20c:29ff:fec6:be59/64 Scope:Link
 UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1
 RX packets:4 errors:0 dropped:0 overruns:0 frame:0
 TX packets:502 errors:0 dropped:0 overruns:0 carrier:0
 collisions:0 txqueuelen:1000
 RX bytes:258 (258.0 b)  TX bytes:66516 (64.9 KiB)
 Interrupt:10 Base address:0x1480

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