try using # strace df -h
If strace not installed , then run # yum install strace* --enablerepo=*
Tuesday, November 21, 2017
How to check mounted filesystems when df command hung in linux ?
In general df is the regular command to check mounted filesystems. other than that , command # mount is the option to check .
# mount
can compare with # mount vs # cat /etc/fstab
# mount
can compare with # mount vs # cat /etc/fstab
how to calculate load average in linux ?
load average: 0.00, 0.00, 0.00
load average gives 3 time intervals which are 1,5,15ms interval
As above load average last 1min load is 0% at last 5ms load is 0% and last 15ms load is 0%
load average gives 3 time intervals which are 1,5,15ms interval
As above load average last 1min load is 0% at last 5ms load is 0% and last 15ms load is 0%
uptime command in linux
load average: 0.00, 0.00, 0.00
load average gives 3 time intervals which are 1,5,15ms interval
As above load average last 1min load is 0% at last 5ms load is 0% and last 15ms load is 0%
load average gives 3 time intervals which are 1,5,15ms interval
As above load average last 1min load is 0% at last 5ms load is 0% and last 15ms load is 0%
df command hung in linux
what could be the reasons for df command hung ?
* NAS issue
- Try to see if your seeing any NFS stale erros with nas filesystems or NFS server may not responding
* High load
- could be due to high load , check with uptime command for high load. there could be chances of huge IO request on any filesystems , some hung commands like df ,ls,sshd ,defunct process
* I/O errors
- could be chances of IO errors with NAS and local disks.
how-to-check-which-causing-for-df command to hung ?
how-to-check-mounted-filesystems when df command hung
* NAS issue
- Try to see if your seeing any NFS stale erros with nas filesystems or NFS server may not responding
* High load
- could be due to high load , check with uptime command for high load. there could be chances of huge IO request on any filesystems , some hung commands like df ,ls,sshd ,defunct process
* I/O errors
- could be chances of IO errors with NAS and local disks.
how-to-check-which-causing-for-df command to hung ?
how-to-check-mounted-filesystems when df command hung
Thursday, November 16, 2017
How to fsck without root password ?
You can give a try change the password going to single user mode . and then do fsck at single user mode .
If its not going to single user mode due to inode issue or read only filesystem then give try to go shell prompt using " init=/bin/bash" option editing kernel at grub menu.
Refer below to go bash shell
How to get shell prompt in linux without root password ?
How to fsck a filesystem in linux ?
fsck -y /dev/mapper/<vgname>/<lvname>
for example :- fsck -y /dev/mapper/vglinux/lvvar
for example :- fsck -y /dev/mapper/vglinux/lvvar
Tuesday, June 6, 2017
Basic for lo script in unix ?
lets assume you have kill 100's of process id's on server . then
put all your process id's in one file for ex # /tmp/test
for i in `cat /tmp/test`
do
kill -9 $i
done
put all your process id's in one file for ex # /tmp/test
for i in `cat /tmp/test`
do
kill -9 $i
done
Sunday, April 23, 2017
Find/Locate Commands in Linux ?
Locate is the best command in Linux terminal to determine the files in server or path of the file .
syntax :- locate <filename>
Find also similar to the locate command
syntax :- find </foldername> -name <filename?
ex :- find /tmp -name file1
I just created a file which doesnt showup with locate/find command ?
yes usually database will update by linux cronjob which typically runs during night. In order to update the database right away run # updatedb
[root@linuxtechnotes ~]#
[root@linuxtechnotes ~]# locate file20
locate: can not stat () `/var/lib/mlocate/mlocate.db': No such file or directory
[root@linuxtechnotes ~]# touch /tmp/file20
[root@linuxtechnotes ~]# locate file20
locate: can not stat () `/var/lib/mlocate/mlocate.db': No such file or directory
[root@linuxtechnotes ~]# updatedb
[root@linuxtechnotes ~]# locate file20
[root@linuxtechnotes ~]# locate file20
[root@linuxtechnotes ~]# find /tmp/ -name file20
/tmp/file20
[root@linuxtechnotes ~]# updatedb
[root@linuxtechnotes ~]# locate file20
[root@linuxtechnotes ~]# find /tmp/ -name file21
[root@linuxtechnotes ~]# touch /tmp/file21
[root@linuxtechnotes ~]# find /tmp/ -name file21
/tmp/file21
[root@linuxtechnotes ~]#
syntax :- locate <filename>
Find also similar to the locate command
syntax :- find </foldername> -name <filename?
ex :- find /tmp -name file1
I just created a file which doesnt showup with locate/find command ?
yes usually database will update by linux cronjob which typically runs during night. In order to update the database right away run # updatedb
[root@linuxtechnotes ~]#
[root@linuxtechnotes ~]# locate file20
locate: can not stat () `/var/lib/mlocate/mlocate.db': No such file or directory
[root@linuxtechnotes ~]# touch /tmp/file20
[root@linuxtechnotes ~]# locate file20
locate: can not stat () `/var/lib/mlocate/mlocate.db': No such file or directory
[root@linuxtechnotes ~]# updatedb
[root@linuxtechnotes ~]# locate file20
[root@linuxtechnotes ~]# locate file20
[root@linuxtechnotes ~]# find /tmp/ -name file20
/tmp/file20
[root@linuxtechnotes ~]# updatedb
[root@linuxtechnotes ~]# locate file20
[root@linuxtechnotes ~]# find /tmp/ -name file21
[root@linuxtechnotes ~]# touch /tmp/file21
[root@linuxtechnotes ~]# find /tmp/ -name file21
/tmp/file21
[root@linuxtechnotes ~]#
How to set cronjobs ? Syntax and examples ?
crontab - maintain crontab files for individual users
How to get all list of crontab scheduled users on server
#ls /var/spool/cron/
files :-
/etc/crontab >> is main file
/etc/cron.allow >> who all have access to cronjobs
/etc/cron.deny >> who all doesnt have access to cronjobs
syntax :-
# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user-name command to be executed
* * * * * root touch /tmp/file1
* means every minute/hour/dat of month/month/day of week
*/2 * * * * root touch /tmp/file1 means it will exicute every 2ms of every hour ,every day.
Below lets take example of minute
*/3 >> is every 3ms
3,5 >> at 3ms and 5ms
2-9 >> every 2ms,3ms---9ms.
Saturday, April 22, 2017
Basic/Easy Overview of Cloud computing ? What is Cloud Computing ? Available types of services ? What are cloud models ?
What is cloud computing ?
Cloud computing is a type of internet based computing that provides computer processing resources and data to computer and other devices on demand . Could is available from anywhere in the world to get access which over comes the current problem of accessing the within the network/using VPN.
The main advantage of cloud is , It will provide the resources on demand by itself like servers,storage ,networking and application etc.
what are could computing service models ?
IAAS -Infrastructure as a service
PAAS - platform as a service
SAAS - software as a service
MBaas - MObile Backend as a service
IAAS -Infrastructure as a service ?
IN this service model cloud will provide all the infrastructure stuff as a service like servers,storage,networking on demand
PAAS -platform as a service ?
PAAS service will provide the development environment for developers . Using this service developers can provide operating systems ,programming language execution environment,database and webserver.
SAAS - software as a service ?
In this model, users gain access to application software and databases. Cloud providers manage the infrastructure and platforms that run the applications.
Cloud users do not manage the cloud infrastructure and platform where the application runs.
This eliminates the need to install and run the application on the cloud user's own computers, which simplifies maintenance and support.
MBaas - MObile Backend as a service ?
In this service model web app and mobile app developers are provided with a way to link their applications to cloud storage and cloud computing services with application programming interfaces (APIs)
exposed to their applications and custom software development kits . Services include user management, push notifications, integration with social networking services and more.
What are different types of could deployment models ?
private cloud
public cloud
hybrid cloud
community cloud
Private cloud :- In this model ,services delicately assigned to single organization which will available within the data centers to organization .Also the services are managed by the organization
The main advantage is security over the data
public cloud :- In this model , service are managed by cloud provider. The services are provisioned based on the demand . IT will suitable for non-sensitive data only as services are supports for the multiple customers .
The main advantage is cost saving as organization needs to pay based on usage only .
Hybrid cloud :- Hybrid cloud is combination of private and public cloud . using this model organization can use private cloud for sensitive data and can use public cloud for non-sensitive data.
Community cloud :- This will be used to share the services within the organization like trusted partners
Cloud computing is a type of internet based computing that provides computer processing resources and data to computer and other devices on demand . Could is available from anywhere in the world to get access which over comes the current problem of accessing the within the network/using VPN.
The main advantage of cloud is , It will provide the resources on demand by itself like servers,storage ,networking and application etc.
what are could computing service models ?
IAAS -Infrastructure as a service
PAAS - platform as a service
SAAS - software as a service
MBaas - MObile Backend as a service
IAAS -Infrastructure as a service ?
IN this service model cloud will provide all the infrastructure stuff as a service like servers,storage,networking on demand
PAAS -platform as a service ?
PAAS service will provide the development environment for developers . Using this service developers can provide operating systems ,programming language execution environment,database and webserver.
SAAS - software as a service ?
In this model, users gain access to application software and databases. Cloud providers manage the infrastructure and platforms that run the applications.
Cloud users do not manage the cloud infrastructure and platform where the application runs.
This eliminates the need to install and run the application on the cloud user's own computers, which simplifies maintenance and support.
MBaas - MObile Backend as a service ?
In this service model web app and mobile app developers are provided with a way to link their applications to cloud storage and cloud computing services with application programming interfaces (APIs)
exposed to their applications and custom software development kits . Services include user management, push notifications, integration with social networking services and more.
What are different types of could deployment models ?
private cloud
public cloud
hybrid cloud
community cloud
Private cloud :- In this model ,services delicately assigned to single organization which will available within the data centers to organization .Also the services are managed by the organization
The main advantage is security over the data
public cloud :- In this model , service are managed by cloud provider. The services are provisioned based on the demand . IT will suitable for non-sensitive data only as services are supports for the multiple customers .
The main advantage is cost saving as organization needs to pay based on usage only .
Hybrid cloud :- Hybrid cloud is combination of private and public cloud . using this model organization can use private cloud for sensitive data and can use public cloud for non-sensitive data.
Community cloud :- This will be used to share the services within the organization like trusted partners
Sunday, March 26, 2017
What is SSD disks ? and Its advantages ?
SSD is called as Solid State Drives
SSD is used for companly used data to improve DISK IO
Advantages :-
SSD disks are Faster than traditional hard disks.
less power consumption, heat and noice.
DIS Advantage s:-
SSd's are more expensive than traditoinal disks
SSD is used for companly used data to improve DISK IO
Advantages :-
SSD disks are Faster than traditional hard disks.
less power consumption, heat and noice.
DIS Advantage s:-
SSd's are more expensive than traditoinal disks
Swap space in Linux ?
Swap space :- It is useful when linux system needed more physical memory .
swapon to see current swap devices
Fdisk commands in Linux ?
fdisk -l to list all the disks
w- to save
d -to delete
p - primary partition
e- extended partition
n- for new partition
Tuesday, March 21, 2017
Ruby:- How to get the output in same line in ruby
you can try using chomp . for example
variable=`linux`
variable1=technotes
output=#{variable} #{variable1}
output =linux
technotes
To get in same line
variable=`hi`.chomp
variable=`linux`.chomp
output=#{variable} #{variable1}
output =linux technotes
variable=`linux`
variable1=technotes
output=#{variable} #{variable1}
output =linux
technotes
To get in same line
variable=`hi`.chomp
variable=`linux`.chomp
output=#{variable} #{variable1}
output =linux technotes
Monday, March 20, 2017
Register with us
https://docs.google.com/forms/d/e/1FAIpQLSerBZUG7vknhLwzXefKstA_2hnGzIIZOCrD2XbvERDgjPah6A/viewform?c=0&w=1
Tuesday, March 14, 2017
Thursday, February 23, 2017
What is D state process and how to check ? And what is the impact of it ?
To check the d state prcoess
#ps axl | awk '$10 ~ /D/'
#ps -aux
D state occurs when the process is in uninterruptible sleep. This state is bad, because you can't do anything with the process in D state. Fortunately, process normally remains in such state not for so long. But if you have a heap of D state processes then some logic in system is disrupt. If that is happening, the very important thing is to determine where this unlucky sleep occurs. It is easy to do with ps command with l option. WCHAN column shows the name of the kernel function where the process is sleeping:
State D means uninterruptible sleep, which usually means IO. When the IO completes the process will change state. If you think a specific process is hung you can truss or strace it to see what it is doing. i.e.
strace -p <pid of process>
If it does nothing for a long time it is more than likely stuck.
It may nothing to do with which disk folder.
The D state process effect cpu/processor scheduling.
Theoretically, D state still occupying cpu/processor resources.
So if too many D state processes, the cpus are busy on scheduling and re-scheduling (that is why we see high system load).
So the result could be unpredictable.
How to clear D-state process ?
D-state process is nothing but uninterruptible sleep. When doing IO, the process is locked as uninterruptible so the data will not be corrupted. When IO finished, the process will not be D-sate
But for some reason the IO could not be finished or hung, then the process may stick in D. in this cases we need to reboot the server to clear D-state process.
How to check CPU /memory of particular process ?
We can check from top command also can get it using below command
#ps -p <pid> -o %cpu
[root@linuxtechnotes ~]# ps -p 19930 -o %mem
%MEM
0.0
[root@linuxtechnotes ~]#
[root@linuxtechnotes ~]# ps -p 19930 -o %cpu
%CPU
97.0
[root@linuxtechnotes ~]#
[root@linuxtechnotes ~]#
#ps -p <pid> -o %cpu
[root@linuxtechnotes ~]# ps -p 19930 -o %mem
%MEM
0.0
[root@linuxtechnotes ~]#
[root@linuxtechnotes ~]# ps -p 19930 -o %cpu
%CPU
97.0
[root@linuxtechnotes ~]#
[root@linuxtechnotes ~]#
How to generate logs in Solaris ?
If Solaris 10,
#/opt/SUNWexplo/bin/explorer
If Solaris 11,
#/usr/sbin/explorer
How to get multiple console connections in Solaris ? Does it possible ?
In Solaris we can get multiple Console connections.However only one must be writable and other connections are readable only .
So we cant get multiple connections with writable .
lets say their was already writable connection and you want to connect to it then how can we do that ?
LDOM :- kill the current telnet process
#ps -ef | grep -i telnet
#kill -9 <process ID>
From then you can able to login to console as writable . However without killing the current process you can get the read access to console
Physical host:-
start -force /SP/console
What is alternate command for telnet to check Connectivity for destination IP and port ?
We can use below command incase telnet is not available
#ssh -v -p <port> <host to connect to>
#ssh -v -p <port> <host to connect to>
How to check vmware tools version from command line ?
#/usr/bin/vmware-toolbox-cmd -v
[root@linuxtechnotes ~]# /usr/bin/vmware-toolbox-cmd -v
9.2.0.15626 (build-799703)
[root@linuxtechnotes ~]#
[root@linuxtechnotes ~]#
[root@linuxtechnotes ~]#
Wednesday, February 15, 2017
How to check history of user logins and reboot history ?
How to check when system was rebooted ?
#last | grep -i reboot
[root@linuxtechnotes ~]#
[root@linuxtechnotes ~]# last | grep -i reboot
reboot system boot 2.6.32-504.el6.i Fri Feb 10 14:02 - 21:10 (5+07:08)
reboot system boot 2.6.32-504.el6.i Sat Feb 4 06:25 - 21:10 (11+14:45)
reboot system boot 2.6.32-504.el6.i Thu Feb 2 08:15 - 21:10 (13+12:55)
reboot system boot 2.6.32-504.el6.i Sun Jan 29 02:42 - 21:10 (17+18:28)
[root@linuxtechnotes ~]#
[root@linuxtechnotes ~]#
How to check history of server who are all logined with time and date ?
#last
[root@linuxtechnotes ~]# last | tail -10
root pts/1 192.168.150.1 Thu Feb 2 16:26 - 19:22 (02:55)
root pts/0 :0.0 Thu Feb 2 16:22 - crash (1+14:02)
root tty1 :0 Thu Feb 2 16:22 - crash (1+14:03)
reboot system boot 2.6.32-504.el6.i Thu Feb 2 08:15 - 21:11 (13+12:55)
root pts/1 192.168.150.1 Sun Jan 29 20:57 - 21:45 (00:48)
linuxtec pts/0 :0.0 Sun Jan 29 15:36 - crash (3+16:39)
linuxtec tty1 :0 Sun Jan 29 15:35 - crash (3+16:39)
reboot system boot 2.6.32-504.el6.i Sun Jan 29 02:42 - 21:11 (17+18:28)
wtmp begins Sun Jan 29 02:42:35 2017
[root@linuxtechnotes ~]#
Day to Day usage commands in LInux ?
How to know the hostname of server ?
Command "hostname" will give you the host name of the server. from the below example linuxtechnotes is the hostname of server.
[root@linuxtechnotes ~]# hostname
linuxtechnotes
[root@linuxtechnotes ~]#
How to know the present working directory ?
command "pwd" will give you current working directory . as per below example /root is the current directory .
[root@linuxtechnotes ~]#
[root@linuxtechnotes ~]# pwd
/root
[root@linuxtechnotes ~]#
How can we know who all logined to server currently ?
#who
[root@linuxtechnotes ~]# who
linuxtechnotes tty1 2017-02-10 22:03 (:0)
linuxtechnotes pts/0 2017-02-14 22:34 (:0.0)
root pts/1 2017-02-15 20:55 (192.168.150.1)
[root@linuxtechnotes ~]#
[root@linuxtechnotes ~]#
How to know time and date in server ?
# date
[root@linuxtechnotes ~]# date
Wed Feb 15 20:58:10 PST 2017
[root@linuxtechnotes ~]#
[root@linuxtechnotes ~]#
How to know the current shell user login ?
#whoami
[root@linuxtechnotes ~]# whoami
root
[root@linuxtechnotes ~]#
[root@linuxtechnotes ~]#
How to get calender in server ?
#cal
[root@linuxtechnotes ~]#
[root@linuxtechnotes ~]#
[root@linuxtechnotes ~]# cal
February 2017
Su Mo Tu We Th Fr Sa
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28
How to use calculator in server ?
# bc
[root@linuxtechnotes ~]# bc
bc 1.06.95
Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
19-5
14
^C
(interrupt) Exiting bc.
How to check current terminal ?
#tty
[root@linuxtechnotes ~]# tty
/dev/pts/1
How to check total memory and its usage ?
# free -m /free -g
[root@linuxtechnotes ~]# free -m
total used free shared buffers cached
Mem: 1893 640 1253 3 130 328
-/+ buffers/cache: 180 1712
Swap: 511 0 511
[root@linuxtechnotes ~]#
How to check system uptime ?
#uptime
[root@linuxtechnotes ~]# uptime
21:07:05 up 1 day, 18:01, 3 users, load average: 0.00, 0.00, 0.00
[root@linuxtechnotes ~]#
How to check system kernel and Os details ?
[root@linuxtechnotes ~]# uname -a
Linux linuxtechnotes 2.6.32-504.el6.i686 #1 SMP Tue Sep 16 01:56:19 EDT 2014 i686 i686 i386 GNU/Linux
[root@linuxtechnotes ~]#
[root@linuxtechnotes ~]# uname -r
2.6.32-504.el6.i686
[root@linuxtechnotes ~]#
[root@linuxtechnotes ~]#
How to check when system was rebooted ?
#last | grep -i reboot
[root@linuxtechnotes ~]#
[root@linuxtechnotes ~]# last | grep -i reboot
reboot system boot 2.6.32-504.el6.i Fri Feb 10 14:02 - 21:10 (5+07:08)
reboot system boot 2.6.32-504.el6.i Sat Feb 4 06:25 - 21:10 (11+14:45)
reboot system boot 2.6.32-504.el6.i Thu Feb 2 08:15 - 21:10 (13+12:55)
reboot system boot 2.6.32-504.el6.i Sun Jan 29 02:42 - 21:10 (17+18:28)
[root@linuxtechnotes ~]#
[root@linuxtechnotes ~]#
How to check history of server who are all logined with time and date ?
#last
[root@linuxtechnotes ~]# last | tail -10
root pts/1 192.168.150.1 Thu Feb 2 16:26 - 19:22 (02:55)
root pts/0 :0.0 Thu Feb 2 16:22 - crash (1+14:02)
root tty1 :0 Thu Feb 2 16:22 - crash (1+14:03)
reboot system boot 2.6.32-504.el6.i Thu Feb 2 08:15 - 21:11 (13+12:55)
root pts/1 192.168.150.1 Sun Jan 29 20:57 - 21:45 (00:48)
linuxtec pts/0 :0.0 Sun Jan 29 15:36 - crash (3+16:39)
linuxtec tty1 :0 Sun Jan 29 15:35 - crash (3+16:39)
reboot system boot 2.6.32-504.el6.i Sun Jan 29 02:42 - 21:11 (17+18:28)
wtmp begins Sun Jan 29 02:42:35 2017
[root@linuxtechnotes ~]#
Monday, February 13, 2017
Does the "dmesg" log will shows the time and date ?
Answer is no .we usually see lot of errros in dmesg which may not showup in syslog . But the drawback is dmesg won't show up date and time . So we are not sure on when that was happend. Whereas in syslog we can see logs with date and time .
Do we need to reboot the system in order to update the kernel package? Just to update without activating it ?
Answer is "NO". Actually In Linux we dont need to reboot the server to install any of the package .
same as in above example inorder to update/install the kernel package we dont need to reboot the system . However if you want to activate/boot into the new kernel then we need to reboot the server .
same as in above example inorder to update/install the kernel package we dont need to reboot the system . However if you want to activate/boot into the new kernel then we need to reboot the server .
Saturday, February 11, 2017
What are all Linux Folders and its details/usage ?
1) / (slash) :-
* / is called as root /super user .
* It is parent directory for all other directories.
* It is called as ROOT directory.
* It is
represented by forward slash(/).
2) /root :-
* /root is home directory for root user(super user)
* It provides working environment for root user
3) /boot :-
* /boot contains bootable files Like Grub.conf .
4) /usr :-
* By default system software’s are installed in /usr directory.
5) /sbin :-
* /sbin contains commands used by only Super User(root)
6) /bin :-
* /bin contains
commands used by all users and binary files.
7)
/home :-
* It is home
directory for all local users.
* It
provides working environment for other users (other than root).
8) /etc :-
* /etc contains all configuration files like
> /etc/passwd for all local users details
> /etc/sysconfig/network uses for network file .
9) /opt :-
* /opt is optional directory for /usr/local.
* It contains all third party softwares.
10) /var :-
* /var is containing variable data like mails, log files.
11) /mnt :-
* /mnt is default mount point for any partition.
* It is empty by default.
* It contains all of removable media like cdrom, pen drive
12)
/proc :-
* /proc contains all the process files
* This
folder contents are not permanent, they keep change.
* It's
file contain useful information used by OS like,
> /proc/meminfo To check system memory details.
>/proc/cpuinfo To check system cpu details.
13) /dev :-
* /dev contains device files like
/dev/hda for harddisk
/dev/cdrom for cdrom
14) /lib :-
* /lib contains library files which are used by OS.
* library
files in linux are shared object files .
15)
/tmp :-
* /tmp contains all the temp files.
Friday, February 10, 2017
Is it possible to upgrade Linux Os version from 5x to 6x ? For example 5.8/5.11 versions to 6.6/6.8 ? Have you ever tried ?
Actually the answer is "NO". We cant upgrade any Linux OS version from one version to different version like from 4x to 5x or 5x to 6x.
I personally tried to install/update package using 6.8 repo on 5.11 servers , but it didnt wrok .
But you can upgrade to any version within perticular version like from 5.1 to you can directly upgrade to 5.x versions like 5.2----5.11) same like for 6x/7x.
Try comment yourself below if any ??????
I personally tried to install/update package using 6.8 repo on 5.11 servers , but it didnt wrok .
But you can upgrade to any version within perticular version like from 5.1 to you can directly upgrade to 5.x versions like 5.2----5.11) same like for 6x/7x.
Try comment yourself below if any ??????
Saturday, February 4, 2017
How to check Disk Performance using iostat Commands ?
Using iostat command we can get CPU, Device and Network Filesystem report.
# iostat -xm 2 >> using this command you can see read/write statistics in mb's as below for every 2sec.
#iostat -xm 2 6 >> This will gives performance report of 6 intervals of every 2sec's.
So As per the above examples
rrqm/s
The number of read requests merged per second that were queued to the device.
wrqm/s
The number of write requests merged per second that were queued to the device.
r/s
The number of read requests that were issued to the device per second.
w/s
The number of write requests that were issued to the device per second.
rMB/s
The number of megabytes read from the device per second.
wMB/s
The number of megabytes written to the device per second.
avgrq-sz
The average size (in sectors) of the requests that were issued to the device.
avgqu-sz
The average queue length of the requests that were issued to the device.
await
The average time (in milliseconds) for I/O requests issued to the device to be served.
%util
Percentage of CPU time during which I/O requests were issued to the device (bandwidth utilization for the device). Device saturation occurs when this
value is close to 100%.
From the above example since we have one Deivce(sda) its ok . If we have multiple Devices how can we know which file is related to what ?
Using #lsblk Command we can find that .
Does Limits.d file overwrites to limits.conf file ?
Does limits.d will overwrite to limits.conf file ?. Below you can see how it works ?
[root@linuxtechnotes ~]# cat /etc/security/limits.d/90-nproc.conf
# Default limit for number of user's processes to prevent
# accidental fork bombs.
# See rhbz #432903 for reasoning.
* soft nproc 1024
root soft nproc unlimited
john soft nproc 8000
john hard nproc 8000
john soft nofile 8000
john hard nofile 8000
[root@linuxtechnotes ~]# su - john
[john@linuxtechnotes ~]$ ulimit -n -u
open files (-n) 8000
max user processes (-u) 8000
[john@linuxtechnotes ~]$ cat /etc/security/limits.conf | tail -3
#@student - maxlogins 4
# End of file
[john@linuxtechnotes ~]$ whoami
john
[john@linuxtechnotes ~]$
Now below you can see i have setup values as 65535 in limits.conf file and 8000 in limits.d file . you can see below on which file wins
[root@linuxtechnotes ~]# cat /etc/security/limits.d/90-nproc.conf
# Default limit for number of user's processes to prevent
# accidental fork bombs.
# See rhbz #432903 for reasoning.
* soft nproc 1024
root soft nproc unlimited
john soft nproc 8000
john hard nproc 8000
john soft nofile 8000
john hard nofile 8000
[root@linuxtechnotes ~]# su - john
[john@linuxtechnotes ~]$ ulimit -n -u
open files (-n) 8000
max user processes (-u) 8000
[john@linuxtechnotes ~]$ cat /etc/security/limits.conf | tail -3
#@student - maxlogins 4
# End of file
[john@linuxtechnotes ~]$ whoami
john
[john@linuxtechnotes ~]$ exit
logout
[root@linuxtechnotes ~]# vi /etc/security/limits.conf
[root@linuxtechnotes ~]# cat /etc/security/limits.conf | tail -5
# End of file
john soft nofile 65535
john hard nofile 65535
john soft nproc 65535
john hard nproc 65535
[root@linuxtechnotes ~]# su - john
[john@linuxtechnotes ~]$ ulimit -n -u
open files (-n) 8000
max user processes (-u) 8000
[john@linuxtechnotes ~]$ whoami
john
[john@linuxtechnotes ~]$ exit
[root@linuxtechnotes ~]# cat /etc/security/limits.d/90-nproc.conf
# Default limit for number of user's processes to prevent
# accidental fork bombs.
# See rhbz #432903 for reasoning.
* soft nproc 1024
root soft nproc unlimited
john soft nproc 8000
john hard nproc 8000
john soft nofile 8000
john hard nofile 8000
[root@linuxtechnotes ~]# su - john
[john@linuxtechnotes ~]$ ulimit -n -u
open files (-n) 8000
max user processes (-u) 8000
[john@linuxtechnotes ~]$ cat /etc/security/limits.conf | tail -3
#@student - maxlogins 4
# End of file
[john@linuxtechnotes ~]$ whoami
john
[john@linuxtechnotes ~]$ exit
logout
[root@linuxtechnotes ~]# vi /etc/security/limits.conf
[root@linuxtechnotes ~]# cat /etc/security/limits.conf | tail -5
# End of file
john soft nofile 65535
john hard nofile 65535
john soft nproc 65535
john hard nproc 65535
[root@linuxtechnotes ~]# su - john
[john@linuxtechnotes ~]$ ulimit -n -u
open files (-n) 8000
max user processes (-u) 8000
[john@linuxtechnotes ~]$ whoami
john
[john@linuxtechnotes ~]$ exit
so as you see above limits.d wins . its means limits.d over writes to limits.conf file . Now Below lets try to remove the values in limits.d file and see which values reflects .
[root@linuxtechnotes ~]# cat /etc/security/limits.conf | tail -5
# End of file
john soft nofile 65535
john hard nofile 65535
john soft nproc 65535
john hard nproc 65535
[root@linuxtechnotes ~]# su - john
[john@linuxtechnotes ~]$ ulimit -n -u
open files (-n) 8000
max user processes (-u) 8000
[john@linuxtechnotes ~]$ whoami
john
[john@linuxtechnotes ~]$ exit
logout
[root@linuxtechnotes ~]# cat /etc/security/limits.d/90-nproc.conf
# Default limit for number of user's processes to prevent
# accidental fork bombs.
# See rhbz #432903 for reasoning.
* soft nproc 1024
root soft nproc unlimited
john soft nproc 8000
john hard nproc 8000
john soft nofile 8000
john hard nofile 8000
[root@linuxtechnotes ~]# vi /etc/security/limits.d/90-nproc.conf
[root@linuxtechnotes ~]# cat /etc/security/limits.d/90-nproc.conf
# Default limit for number of user's processes to prevent
# accidental fork bombs.
# See rhbz #432903 for reasoning.
* soft nproc 1024
root soft nproc unlimited
[root@linuxtechnotes ~]# su - john
[john@linuxtechnotes ~]$ ulimit -n -u
open files (-n) 65535
max user processes (-u) 65535
[john@linuxtechnotes ~]$ whoami
john
[john@linuxtechnotes ~]$
[root@linuxtechnotes ~]# cat /etc/security/limits.conf | tail -5
# End of file
john soft nofile 65535
john hard nofile 65535
john soft nproc 65535
john hard nproc 65535
[root@linuxtechnotes ~]# su - john
[john@linuxtechnotes ~]$ ulimit -n -u
open files (-n) 8000
max user processes (-u) 8000
[john@linuxtechnotes ~]$ whoami
john
[john@linuxtechnotes ~]$ exit
logout
[root@linuxtechnotes ~]# cat /etc/security/limits.d/90-nproc.conf
# Default limit for number of user's processes to prevent
# accidental fork bombs.
# See rhbz #432903 for reasoning.
* soft nproc 1024
root soft nproc unlimited
john soft nproc 8000
john hard nproc 8000
john soft nofile 8000
john hard nofile 8000
[root@linuxtechnotes ~]# vi /etc/security/limits.d/90-nproc.conf
[root@linuxtechnotes ~]# cat /etc/security/limits.d/90-nproc.conf
# Default limit for number of user's processes to prevent
# accidental fork bombs.
# See rhbz #432903 for reasoning.
* soft nproc 1024
root soft nproc unlimited
[root@linuxtechnotes ~]# su - john
[john@linuxtechnotes ~]$ ulimit -n -u
open files (-n) 65535
max user processes (-u) 65535
[john@linuxtechnotes ~]$ whoami
john
[john@linuxtechnotes ~]$
Sunday, January 29, 2017
Useful Commands for VERITAS VCS/VOM
VCS Main Configuration File :-
/etc/VRTSvcs/conf/config/main.cf
How to get read-write(rw) mode to main.cf :-
haconf -makerw
To get Read-only (ro) :-
haconf -dump -makero
How to stop the cluster /vcs:-
hastop -all > To stop on all nodes
hastop -local > To stop just on local node
hastop -all -force > To stop Forcefully
How to offline a Service group :-
hagrp -offline <SG> -any
How to online a Service group :-
hagrp -online <sg> -sys <sysname>
How to switch a Service group :-
hagrp -switch <sg> -to -sys <nodename>
How to Freeze/Unfreeze Service Groups in VCS :-
we have 2 options :- Persistent and temporary
The option
-persistent
enables the freeze to be remembered when the cluster is rebooted.The option -Temporary is just for temporary change . it wont apply after reboot .
To freeze a service group :-
hagrp -freeze
service_group
[-persistent]
hagrp -unfreeze
service_group
[-persistent]
Examples of Netstat Commands ?
Netstat :-
Netstat is useful command which will helps us to determine the Print network connections, routing tables, interface statistics, masquerade connections, and multicast memberships.
Below are some useful netstat command examples :-
[root@linuxtechnotes ~]# netstat -aunt
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:199 0.0.0.0:* LISTEN
tcp 1 0 192.168.150.129:54189 23.59.189.83:80 CLOSE_WAIT
tcp 0 64 192.168.150.129:22 192.168.150.1:53360 ESTABLISHED
tcp 0 0 :::22 :::* LISTEN
tcp 0 0 ::1:631 :::* LISTEN
tcp 0 0 ::1:25 :::* LISTEN
udp 0 0 0.0.0.0:161 0.0.0.0:*
udp 0 0 0.0.0.0:68 0.0.0.0:*
udp 0 0 0.0.0.0:631 0.0.0.0:*
[root@linuxtechnotes ~]#
[root@linuxtechnotes ~]# netstat -tunlap
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 7544/sshd
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 7364/cupsd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 7657/master
tcp 0 0 127.0.0.1:199 0.0.0.0:* LISTEN 9474/snmpd
tcp 1 0 192.168.150.129:54189 23.59.189.83:80 CLOSE_WAIT 26225/clock-applet
tcp 0 0 192.168.150.129:22 192.168.150.1:53360 ESTABLISHED 5996/sshd
tcp 0 0 :::22 :::* LISTEN 7544/sshd
tcp 0 0 ::1:631 :::* LISTEN 7364/cupsd
tcp 0 0 ::1:25 :::* LISTEN 7657/master
udp 0 0 0.0.0.0:161 0.0.0.0:* 9474/snmpd
udp 0 0 0.0.0.0:68 0.0.0.0:* 1413/dhclient
udp 0 0 0.0.0.0:631 0.0.0.0:* 7364/cupsd
[root@linuxtechnotes ~]#
[root@linuxtechnotes ~]# netstat -tunlap | grep -i 161
udp 0 0 0.0.0.0:161 0.0.0.0:* 9474/snmpd
[root@linuxtechnotes ~]#
[root@linuxtechnotes ~]# netstat -tunlap | grep -i 22
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 7544/sshd
tcp 1 0 192.168.150.129:54189 23.59.189.83:80 CLOSE_WAIT 26225/clock-applet
tcp 0 64 192.168.150.129:22 192.168.150.1:53360 ESTABLISHED 5996/sshd
tcp 0 0 :::22 :::* LISTEN 7544/sshd
[root@linuxtechnotes ~]#
From the above examples you can see tcp and UDP connectoins with ports and its status .
LISTEN means :- The socket is listening for incoming connections
ESTABLISHED :- The socket has an established connection.
SYN_SENT :- The socket is actively attempting to establish a connection.
LISTEN means :- The socket is listening for incoming connections
ESTABLISHED :- The socket has an established connection.
CLOSE_WAIT :- The remote end has shut down, waiting for the socket to close.
TIME_WAIT : - The socket is waiting after close to handle packets still in the network.
TIME_WAIT : - The socket is waiting after close to handle packets still in the network.
CLOSED :- The socket is not being used.
CLOSE_WAIT :- The remote end has shut down, waiting for the socket to close.
LAST_ACK :- The remote end has shut down, and the socket is closed. Waiting for acknowledgement.
CLOSING :- Both sockets are shut down but we still don’t have all our data sent.
UNKNOWN :- The state of the socket is unknown.
SYN_SENT :- The socket is actively attempting to establish a connection.
SYN_RECV :- A connection request has been received from the network.
FIN_WAIT1 :- The socket is closed, and the connection is shutting down.
FIN_WAIT2 :- Connection is closed, and the socket is waiting for a shutdown from the remote end.
How to check port connection/status ?
From the below example you can see status of ports of 161 and 22 .
Same way you can change it to your port number and grep .
[root@linuxtechnotes ~]# netstat -tunlap | grep -i 161
udp 0 0 0.0.0.0:161 0.0.0.0:* 9474/snmpd
[root@linuxtechnotes ~]#
[root@linuxtechnotes ~]# netstat -tunlap | grep -i 22
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 7544/sshd
tcp 1 0 192.168.150.129:54189 23.59.189.83:80 CLOSE_WAIT 26225/clock-applet
tcp 0 64 192.168.150.129:22 192.168.150.1:53360 ESTABLISHED 5996/sshd
tcp 0 0 :::22 :::* LISTEN 7544/sshd
[root@linuxtechnotes ~]#
Subscribe to:
Posts (Atom)