Monday, December 29, 2014

How to use Tail,Head,More,less Commands ?


Tail Commands :-


tail  is used to  output the last part of files
# tail <filename>                         It willl list the last part of files.
# tail -f <filename>                     It will list the  output appended data as the file grows
#cat /var/log/messages |tail -5    It will list last 5 files







Head Commands :- 


head Is used to output the first part of files
#head <filename>
#cat /var/log/messages | head -5 






more Command :- 

more <filename>




Less Command :-



  less <filename>



Tuesday, April 8, 2014

How To Create/extend LVM snap ?

How To Create LVM snap ?

lvcreate -L <size> -n <snampname> <lvname including path>

To extend ?

lvextend -L +<size>  <lvname including path>

Tuesday, March 18, 2014

How to create Raid file system in Linux ?

How to create a RAID volume 1  ?

syntax :- mdadm --create  <raid devicename>  --level=<raid level>  <devises>

for ex :- mdadm --create /dev/md1  --level=1 --raid-devices=2  /dev/sdb1 /dev/sdb2

TO get details of raid device ?

mdadm--detail /dev/md1

TO check the current active raid device :- 

cat /proc/mdstat

To create a filesystem  ?

syntax :- mkfs -t xfs  <devicename>
for ex :- mkfs -t xfs  /dev/md1

How to add new disk to existing raid ?

syntax :- mdadm <existing raid device>  --add  <new device >

for ex :- mdadm /dev/md1  --add </dev/sdc>

to increase 

mdadm --grow --raid-devices=3 /dev/md1



fstab entries

/dev/md1 <mountpath> <filesystemtype> defaults 0 0

Thursday, January 2, 2014

What is SNMP? and its Configuration ?


SNMP :-   Simple Network Management  Protocol.

SNMP is useful to figure out whats exactly happening from  Device on Network.

SNMP is a agent which runs on Device and It will helps to monitor hardware/memory/CPU status in System . It will gather the information and sent to to management console .
port number for SNMP is 161.

[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        0      0 192.168.150.129:54189       23.59.189.83:80             ESTABLISHED
tcp        1      1 192.168.150.129:54188       23.59.189.83:80             LAST_ACK
tcp        0      0 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 ~]#



Configuration file  :- /etc/snmp/snmpd.conf

what is the debug file for SNMP ?

for 5.x Linux servers its :- /etc/sysconfig/snmpd.options
For 6x :-   /etc/sysconfig/snmpd

Below you can see default debug file for 6x Linux servers.

[root@linuxtechnotes ~]# cat /etc/sysconfig/snmpd
# snmpd command line options
# OPTIONS="-LS0-6d -Lf /dev/null -p /var/run/snmpd.pid"
[root@linuxtechnotes ~]#


Incase if you notice lot of udp connection in syslog and if you want to suppress, try to change the debug level to 5 and restart the snmpd deamon.


[root@linuxtechnotes ~]# cat /etc/sysconfig/snmpd
# snmpd command line options
OPTIONS="-LS0-5d -Lf /dev/null -p /var/run/snmpd.pid"
[root@linuxtechnotes ~]#
[root@linuxtechnotes ~]# service snmpd restart
Stopping snmpd:                                            [  OK  ]
Starting snmpd:                                            [  OK  ]
[root@linuxtechnotes ~]#