Tuesday, January 7, 2020

Linux Interview questions.

I have posted only the questions for LINUX admin here.


1.  What is GRUB
2.  Explain Linux Boot Process
3. The Linux boot process:
4. What are LVM1 and LVM2?
5. List of important LVM related files and Directories?
6. How to create and extend a File system in Linux?
7. How to add new LUN from storage to Linux server? step by step procedure.
8. How to check server is configured with Multipath disks??
9.  How do you build the ser

Monday, June 25, 2018

Cluster log information

Port Function

Port Function 

a   gab driver
b   I/O fencing (designed to guarantee data integrity)
d   ODM (Oracle Disk Manager)
f   CFS (Cluster File System)
h   VCS (VERITAS Cluster Server: high availability daemon)
o   VCSMM driver (kernel module needed for Oracle and VCS interface)
q   QuickLog daemon
v   CVM (Cluster Volume Manager)
w   vxconfigd (module for cvm)

===============================================================

Cluster Log Files:
---------------------
Log Directory                 /var/VRTSvcs/log
primary log file (engine log file)     /var/VRTSvcs/log/engine_A.log
==============================================================================================================
Dynamic Configuration
---------------------
Change configuration to read/write mode     haconf -makerw
Change configuration to read-only mode         haconf -dump -makero
Check what mode cluster is running in         haclus -display |grep -i 'readonly'

0 = write mode
1 = read only mode

Check the configuration file             hacf -verify /etc/VRTSvcs/conf/config
Note: you can point to any directory as long as it has main.cf and types.cf

convert a main.cf file into cluster commands     hacf -cftocmd /etc/VRTSvcs/conf/config -dest /tmp
convert a command file into a main.cf file     hacf -cmdtocf /tmp -dest /etc/VRTSvcs/conf/config
========================================================
Resource Operations
--------------------

Online a resource    
hares -online <resource> -sys [sys]

Offline a resource
hares -offline <resource> -sys  [-sys]

Display the state of a resource( offline, online, etc)    
hares -state

Display the parameters of a resource    
hares -display <resource>

Offline a resource and propagate the command to its children    
hares -offprop <resource> -sys <sys>

Cause a resource agent to immediately monitor the resource
hares -probe <resource> -sys <sys>

Clearing a resource (automatically initiates the onlining)
hares -clear <resource> [-sys]
====================================================================

Gab and LLT information


To view the LLT information:

#lltstat -n
To view the active llt information
#lltstat -nvv active

To view the llt port information:
#lltstat -p

To view the llt configuration information:
# lltstat -c

LLT configuration files
/etc/llthosts    -- This file contains node id with the node information
/etc/llttab - This file contains the information about the private and public heartbeat nic information

Lists information about each configured LLT link
lltstat -l   

List all MAC addresses in the cluster
lltconfig -a list

Stop the LLT running
lltconfig -U

Start the LLT    
lltconfig -c

Verify that GAB is operating    
gabconfig -a

Note: port a indicates that GAB is communicating, port h indicates that VCS is started

Stop GAB running
gabconfig -U

Start the GAB    
gabconfig -c -n <number of nodes>

Override the seed values in the gabtab file
gabconfig -c -x

configuratio files:
/etc/gabtab:
This file contains the information which willbe used by the gab driver. node count information is stored on this file.

Monday, August 7, 2017

Netmask details


Bitmask (Bits)Dotted DecimalHexadecimalBinary
/00.0.0.00x0000000000000000 00000000 00000000 00000000
/1128.0.0.00x8000000010000000 00000000 00000000 00000000
/2192.0.0.00xc000000011000000 00000000 00000000 00000000
/3224.0.0.00xe000000011100000 00000000 00000000 00000000
/4240.0.0.00xf000000011110000 00000000 00000000 00000000
/5248.0.0.00xf800000011111000 00000000 00000000 00000000
/6252.0.0.00xfc00000011111100 00000000 00000000 00000000
/7254.0.0.00xfe00000011111110 00000000 00000000 00000000
/8255.0.0.00xff00000011111111 00000000 00000000 00000000
/9255.128.0.00xff80000011111111 10000000 00000000 00000000
/10255.192.0.00xffc0000011111111 11000000 00000000 00000000
/11255.224.0.00xffe0000011111111 11100000 00000000 00000000
/12255.240.0.00xfff0000011111111 11110000 00000000 00000000
/13255.248.0.00xfff8000011111111 11111000 00000000 00000000
/14255.252.0.00xfffc000011111111 11111100 00000000 00000000
/15255.254.0.00xfffe000011111111 11111110 00000000 00000000
/16255.255.0.00xffff000011111111 11111111 00000000 00000000
/17255.255.128.00xffff800011111111 11111111 10000000 00000000
/18255.255.192.00xffffc00011111111 11111111 11000000 00000000
/19255.255.224.00xffffe00011111111 11111111 11100000 00000000
/20255.255.240.00xfffff00011111111 11111111 11110000 00000000
/21255.255.248.00xfffff80011111111 11111111 11111000 00000000
/22255.255.252.00xfffffc0011111111 11111111 11111100 00000000
/23255.255.254.00xfffffe0011111111 11111111 11111110 00000000
/24255.255.255.00xffffff0011111111 11111111 11111111 00000000
/25255.255.255.1280xffffff8011111111 11111111 11111111 10000000
/26255.255.255.1920xffffffc011111111 11111111 11111111 11000000
/27255.255.255.2240xffffffe011111111 11111111 11111111 11100000
/28255.255.255.2400xfffffff011111111 11111111 11111111 11110000
/29255.255.255.2480xfffffff811111111 11111111 11111111 11111000
/30255.255.255.2520xfffffffc11111111 11111111 11111111 11111100
/31255.255.255.2540xfffffffe11111111 11111111 11111111 11111110
/32255.255.255.2550xffffffff11111111 11111111 11111111 11111111

Thursday, February 4, 2016

VCS some notes.


GAB maintains cluster membership by receiving  input on the status of the heartbeat from each node by LLT. when a system no longer receives heartbeats from peer, it marks the peer as Down and excludes the peer from the cluster. In VCS,
memberships are sets of system participating in the cluster. VCS has the following types of membership.


1. Regular membership : includes systems that communicate with each other across one or more network channels.
2. Jeopardy  : Membership includes systems that have only one private communication link
3. DAEMON Down node Alive (DDNA) is a condition in which the VCS High availability daemon on a node fails,


but the node is running . in a DDNA condition, VCS does not have information about the state of service groups on the node.
so VCS places all service groups that were online on the affected node in the autodisabled state. Manual intervention is required to
to enable failover of autodisabled service groups. Admin must release the resources running on the affected
node, clear resource faults, and bring the service groups online on another node.



Cluster communications


GAB's second function is reliable cluster communications. GAB provides guaranteed delivery of point-to-point and
broadcast message to all nodes. VCS engine uses a private IOCTL ( Provided by GAB ) to tell GAB that it is alive.



LLT


VCS uses private network communications between cluster nodes for cluster maintenance. The Low Latency Transport functions aas a high performance low-latency replacement for the IP stack, and is used for all cluster communications. Symantec recommends two independent networks between all cluster nodes. these networks provide the required redundancy in the communications path and enable VCS TO DETERMINE a network failure and a system failure.


LLT has two major functions.


1. LLT distributes (load balances ) internode communications across all available private network links. This  distribution means that all cluster communications are evenly distributed across all private network links (Maximum eight) for performance and fault resilence. If a link fails, traffic is redirected to the remaining links
2. Heartbeat
   LLT is responsible for sending and receiving heartbeat traffic over network links. The Group Membership Services
function of GAB uses his heartbeat function to determine cluster membership.






Friday, February 20, 2015

Useful Find Commands , CPU Usage , Crontab

Find command   --


Find
-----

find / -xdev -size +1000000 -exec ls -ltr {} \; |sort -nr
find . -name core -exec rm {} \;
find /opt  -type f -atime +60 -print

find /opt  -size +100000 -exec ls -ltr {} \;


Cpu usage
---------


sar 1
sar -u 10 60
mpstat 10 60
/usr/ucb/ps aux
prstat -avm


1. Sar command
sar
sar -u 12 5  -->
sar -o <filename> 60 10


Type the following command to display per-processor statistics; 12 seconds apart; 5 times
# mpstat 12 5
You can also use traditional ps and top command:

# top
# ps -e -o pcpu -o pid -o user -o args


prtconf

This section shows the hardware architecture (Sun4u, which means that this is a Sun-4 system with an UltraSPARC CPU) and that it has 128MB of RAM.

# psrinfo
# psrinfo -p -

# psrinfo -pv
# psrinfo -v
# psrinfo
# psrinfo -v
# uname -a
# uname -X

$ isainfo -v
$ isainfo -b
$ isainfo -v

/etc/release  - to diplay the contents about release
# cat /etc/release

#showrev
-a Prints all system revision information available.
-c (command) Prints the revision information about command.
-p Prints only the revision information about patches.
-R (root_path) Defines the full path name of a directory to use as the root_path.
-s (host name) Performs this operation on the specified host name.
-w Prints only the OpenWindows revision information


#showrev -a
$ showrev -a
hostid

$ hostid
$ prtconf -b
$ prtconf -vb

How to Display a System's Installed Memory
-----------------------------------------------------------------
To display the amount of memory that is installed on your system,

$ prtconf | grep Memory
$ psrinfo -p
$ psrinfo -pv
$ psrinfo -v

Date
----

# date mmddHHMM[[cc]yy]
mm Month, using two digits.
dd Day of the month, using two digits.
HH Hour, using two digits and a 24-hour clock.
MM Minutes, using two digits.
cc Century, using two digits.
yy Year, using two digits.


# date

# date 0121173404

How to setup a message of the day
-----------------------------------

/etc/motd 

$ cat /etc/motd
Welcome to the UNIX Universe. Have a nice day.

default output

$ cat /etc/motd
Sun Microsystems Inc. SunOS 5.10 Generic May 2004



Crontab
----------

crontab files:
----------------

 /var/spool/cron/crontabs
 /etc/cron.d/cron.allow and
 /etc/cron.d/cron.deny

 

Syntax of crontab File Entries
**********************************

Minute 0-59
Hour 0-23
Day of month 1-31
Month 1-12
Day of week 0-6 (0 = Sunday)


Create a new crontab file, or edit an existing file.
# crontab -e [username]

Verify your crontab file changes.
# crontab -l [username]

How to Verify That a crontab File Exists

#$ ls -l /var/spool/cron/crontabs
-rw-r--r-- 1 root sys 190 Feb 26 16:23 adm
-rw------- 1 root staff 225 Mar 1 9:19 jones
-rw-r--r-- 1 root root 1063 Feb 26 16:23 lp
-rw-r--r-- 1 root sys 441 Feb 26 16:25 root
-rw------- 1 root staff 60 Mar 1 9:15 smith
-rw-r--r-- 1 root sys 308 Feb 26 16:23 sys

How to Display a crontab File
----------------------------

$ crontab -l [username]
$ crontab -l
13 13 * * * chmod g+w /home1/documents/*.book > /dev/null 2>&1


Display the root crontab file
----------------------------
# crontab -l

How to Remove a crontab File
----------------------------$ crontab -r [username]

Verify that the crontab file has been removed.
----------------------------
# ls /var/spool/cron/crontabs

These access control files work together as follows:

* If cron.allow exists, only the users who are listed in this file can create, edit, display, or remove crontab files.
* If cron.allow does not exist, all users can submit crontab files, except for users who are listed in cron.deny.
* If neither cron.allow nor cron.deny exists, superuser privileges are required to run the crontab command.



1. Scheduling a Job For a Specific Time
----------------------------The basic usage of cron is to execute a job in a specific time as shown below. This will execute the Full backup shell script (full-backup) on 10th June 08:30 AM.
Please note that the time field uses 24 hours format. So, for 8 AM use 8, and for 8 PM use 20.
30 08 10 06 * /home/usr1/full-backup
    30 – 30th Minute
    08 – 08 AM
    10 – 10th Day
    06 – 6th Month (June)
    * – Every day of the week


2. Schedule a Job For More Than One Instance (e.g. Twice a Day)
The following script take a incremental backup twice a day every day.

This example executes the specified incremental backup shell script (incremental-backup) at 11:00 and 16:00 on every day. The comma separated value in a field specifies that the command needs to be executed in all the mentioned time.

00 11,16 * * * /home/ramesh/bin/incremental-backup
    00 – 0th Minute (Top of the hour)
    11,16 – 11 AM and 4 PM
    * – Every day
    * – Every month
    * – Every day of the week


3. Schedule a Job for Specific Range of Time (e.g. Only on Weekdays)
-----------------------------------------------------
If you wanted a job to be scheduled for every hour with in a specific range of time then use the following.
Cron Job everyday during working hours

This example checks the status of the database everyday (including weekends) during the working hours 9 a.m – 6 p.m

00 09-18 * * * /home/user1/bin/check-db-status
    00 – 0th Minute (Top of the hour)
    09-18 – 9 am, 10 am,11 am, 12 am, 1 pm, 2 pm, 3 pm, 4 pm, 5 pm, 6 pm
    * – Every day
    * – Every months
    * – Every day of the week


Cron Job every weekday during working hours
-----------------------------------------------------
This example checks the status of the database every weekday (i.e excluding Sat and Sun) during the working hours 9 a.m – 6 p.m.
00 09-18 * * 1-5 /home/ramesh/bin/check-db-status
    00 – 0th Minute (Top of the hour)
    09-18 – 9 am, 10 am,11 am, 12 am, 1 pm, 2 pm, 3 pm, 4 pm, 5 pm, 6 pm
    * – Every day
    * – Every month
    1-5 -Mon, Tue, Wed, Thu and Fri (Every Weekday)


 6. Schedule a Job for Every Minute Using Cron.
-----------------------------------------------------

Ideally you may not have a requirement to schedule a job every minute. But understanding this example will will help you understand the other examples mentioned below in this article.

* * * * * CMD

The * means all the possible unit — i.e every minute of every hour through out the year. More than using this * directly, you will find it very useful in the following cases.

    When you specify */5 in minute field means every 5 minutes.
    When you specify 0-10/2 in minute field mean every 2 minutes in  the first 10 minute.
    Thus the above convention can be used for all the other 4 fields.


7. Schedule a Background Cron Job For Every 10 Minutes.
-----------------------------------------------------
Use the following, if you want to check the disk space every 10 minutes.

*/10 * * * * /home/ramesh/check-disk-space