Solution: Error - "passwd: Sorry: less than 7 days since the last change."

By Parthiban Ponnusamy

 Problem:

When you trying to change password in solaris, you may get the below error:

ORACLE user1$ passwd oracle
Enter existing login password:
passwd: Sorry: less than 7 days since the last change.
Permission denied

Solution:

As root do the following:
# passwd -n 0 oracle

Now, Ask the oracle user to try again.
ORACLE user1$  passwd oracle

Now the Oracle user able to change their password.


Permenant fix:

Take a look at /etc/default/passwd file and check the MINWEEKS Parameter.

You can change it to NULL if you don't want a minimum time between password changes.

Video Tutorial: DNS and DHCP setup in Linux - Part 2

By Parthiban Ponnusamy


Video Tutorial: DNS and DHCP Setup in Linux - Part 1

By Parthiban Ponnusamy


Resizing Online Multipath Disk in Linux

By Parthiban Ponnusamy


Here is the steps to Resize an Online Multipath Disk which is using Linux native device mapper as multipath solution.


1. Resize your physical disk in SAN. SAN Admins will do this. 
2. Use the following command to find the paths to the LUN:
# multipath -l
3. Now, Resize your paths. For SCSI devices, use the following command:
# echo 1 > /sys/block/<device_name>/device/rescan
4. Resize your multipath device by running the multipathd resize command:
# multipathd -k'resize map mpath0'
5. Resize the  File System (Assuming LVM is NOT used)
# resize2fs /dev/mapper/mpath0
If LVM is used, you need to do the following:
#pvscan
Check your Disk Changes detected under LVM:
#pvs or pvdisplay 
#vgscan
To check the VG Size is Increased:
#vgs or vgdisplay
Now Extend the LV: 
#lvextend -L +<SIZE_TO_BE_INCREASED>G <LV_NAME>
Finally Extend the File System
#resize2fs <LV_NAME>


Thats all. You are done 

Hardware Requirements for Windows Server 2008 Editions

By shankar


Windows server 2008 standard Edition Limit support

By shankar

The Standard edition has limited support for some of these roles.
1. For File Services, only one Distributed File System (DFS) root is supported.
2. For Network Policy and Access Services,it is limited to 250 RRAS Connections, 50 IAS connections, and 2 IAS Server Groups.
3. For Terminal Services, it is limited to 250 connections.


Find Out Which Switch Port Connected to Server using tcpdump

By Parthiban Ponnusamy


In Corporate Environments, Some times, you need to find out which Network switch and switch port are connected to which NIC of the server. In these scenarios, you can use "tcpdump" command in your Linux/UNIX shell to find out network switch and switch port which is connected to a NIC.


Note: The server should have tcpdump installed to use this.


Here is the Syntax of the command: 
tcpdump -nn -v -i <NIC_INTERFACE> -s 1500 -c 1 'ether[20:2] == 0x2000
Example:


testsrv1:~ # tcpdump -nn -v -i eth3 -s 1500 -c 1 'ether[20:2] == 0x2000'
tcpdump: listening on eth3, link-type EN10MB (Ethernet), capture size 1500 bytes
03:25:22.146564 CDPv2, ttl: 180s, checksum: 692 (unverified), length 370
   Device-ID (0x01), length: 11 bytes: 'ch-bx48-sw13' 
   Address (0x02), length: 13 bytes: IPv4 (1) 192.168.1.15
   Port-ID (0x03), length: 15 bytes: 'FastEthernet0/7' 
   Capability (0x04), length: 4 bytes: (0x00000028): L2 Switch, IGMP snooping
   Version String (0x05), length: 220 bytes:
   Cisco Internetwork Operating System Software
   IOS (tm) C2950 Software (C2950-I6Q4L2-M), Version 12.1(14)EA1a, RELEASE SOFTWARE (fc1)
   Copyright (c) 1986-2003 by cisco Systems, Inc.
   Compiled Tue 02-Sep-03 03:33 by antonino
   Platform (0x06), length: 18 bytes: 'cisco WS-C2950T-24'
   Protocol-Hello option (0x08), length: 32 bytes:
   VTP Management Domain (0x09), length: 6 bytes: 'ecomrd'
   Duplex (0x0b), length: 1 byte: full
   AVVID trust bitmap (0x12), length: 1 byte: 0x00
   AVVID untrusted ports CoS (0x13), length: 1 byte: 0x00
1 packets captured
2 packets received by filter
0 packets dropped by kernel
testsrv1:~ #
In the above example, The network switch name and Port connected are highlighted. Hope this will be helpful :)

OCFS2 Cluster File System Setup Guide in Linux

By Parthiban Ponnusamy

What is OCFS2?
  • OCFS2 is a shared-disk cluster file system for Linux 
  • Capable of providing both high performance and high availability.  
  • Cluster-aware applications can make use of parallel I/O for higher performance with this FS 
  • OCFS2 is mostly used to host Oracle Real application clusters (RAC) database on Linux clusters. 

The below are the high level steps for creating ocfs2 filesystem on top of a multipath'd SAN LUN:

  1. Verify the nodes that will be part of your cluster.
  2. Make sure your LUNs on the SAN end are accessible on all the nodes of the cluster.
  3. If you need multipathing, configure multipath and the multipathing policy based on solution whatever you have.
  4. The following example configuration ( /etc/ocfs2/cluster.conf ) shows you a sample configuration of a 2 node cluster pool. 
  5. If you have heartbeat IP configured on these cluster nodes, use the heartbeat IP for ocfs2 cluster communication and specify the hostname without FQDN. 
  6. Copy the same file to all the hosts in the cluster. 

Sample Config file:
[root@rac-cluster ~]# cat /etc/ocfs2/cluster.conf
node:
        ip_port = 7777
        ip_address = 192.168.1.2
        number = 0
        name = rac-cluster
        cluster = ocfs2
node:
        ip_port = 7777
        ip_address = 192.168.1.3
        number = 1
        name = rac-cluster
        cluster = ocfs2
 
On each node check the status of OCFS2 cluster service and stop "o2cb" if the service is already running. 
# service o2cb status # service o2cb stop
On each node, load the OCFS2 module. 
# service o2cb load
Make the OCFS2 service online on all the nodes. 
# service o2cb online 
Now your OCFS2 cluster is ready.

Format the SAN lun device from any one of the cluster node. 
# mkfs.ocfs2 -b 4k -C 32k -L oraclerac /dev/emcpowera
Where,
-b : Block size
-C : Cluster size
-L : Label

Update /etc/fstab on all the nodes in the cluster with the mount point. 
/dev/emcpowera /u01 ocfs2 _netdev 0 0 
Mount the /u01 

Enable ocfs and o2b service on boot
# chkconfig --level 345 o2cb on# chkconfig --level 345 ocfs2 on 
The /u01 repository setup on a SAN Lun is done.

You can now configure Oracle RAC on this file System.

Reset Failed Login Count in Linux

By Parthiban Ponnusamy

Depends on the PAM configuration on Linux server, the Pluggable Authentication Module (PAM)

To check the login attempts to see if it needs to be reset type faillog -u <username>
root@testsrv:~ # faillog -u user1
Username Failures Maximum Latest
user1       15        0
Reset the counter with the -r flag:
root@testsrv:~ # /usr/bin/faillog -r user1
Username Failures Maximum Latest
user1        0        0
If you’re root but is not managing to become a user with su, you also need to reset the login counter:
root@testsrv~ # su – username
su: incorrect password
root@testsrv:~ # /sbin/pam_tally —-user user1 —-reset
User user1 (672) had 34
root@testsrv:~ # su – username
user1@testsrv:~ $

Display Hidden Folders Enable or Disable the Option

By shankar

Few times , we won't get the Show Hidden Files and Folders option at Folders --> View Option.There is Fix for through registry edit. Need to copy the contents and paste into notepad then Save it as Your_filename.reg. Double-click the file , and Option will be enabled.

Note: Sometimes, need restart.

***********************************************************************************
Windows Registry Editor Version 5.00

[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\Hidden]

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\Hidden]
"Text"="@shell32.dll,-30499"
"Type"="group"
"Bitmap"=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,\
00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,53,00,\
48,00,45,00,4c,00,4c,00,33,00,32,00,2e,00,64,00,6c,00,6c,00,2c,00,34,00,00,\
00
"HelpID"="shell.hlp#51131"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\Hidden\NOHIDDEN]
"RegPath"="Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced"
"Text"="@shell32.dll,-30501"
"Type"="radio"
"CheckedValue"=dword:00000002
"ValueName"="Hidden"
"DefaultValue"=dword:00000002
"HKeyRoot"=dword:80000001
"HelpID"="shell.hlp#51104"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\Hidden\SHOWALL]
"RegPath"="Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced"
"Text"="@shell32.dll,-30500"
"Type"="radio"
"CheckedValue"=dword:00000001
"ValueName"="Hidden"
"DefaultValue"=dword:00000002
"HKeyRoot"=dword:80000001
"HelpID"="shell.hlp#51105"

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

Video Tutorials: Basic Hardware & Windows in Tamil and Malayalam

By Parthiban Ponnusamy

Another One, I am really happy to share these Video Tutorials for Basic Hardware, Windows XP, Windows 2003 in Tamil and Malayalam languages, which i found on web today. 

It's really nice to see these kind of Technical Video Tutorials in Indian Regional languages such as Tamil, Malayalam, Telugu, Hindi, etc..  The explanation and teaching skill is really good these tutorials. Hope this helps to peoples who starting their career as Windows or Desktop Support.

I really wish these kind of Video Tutorials should come in all the Indian Regional languages. That will help lot and lot of Peoples of India to understand technology better.

Really appreciate and Thank Bitnetz.com Team for their Video Tutorials.

Link? Here you go: 


Happy Learning..!

Linux Video Tutorials in Tamil

By Parthiban Ponnusamy

When I was searching for something yesterday, fortunately, I found something interesting. That is nothing but Linux video tutorials in Tamil. Good to see the Linux Video Tutorials in Tamil language. (Even I had a thought to create these kind of video tutorials and really not started the work for that still. Hope will do something in soon :)


Here you go:


Check out the Linux Video Tutorials in Tamil



I am really happy to share this here..!


I really appreciate and Thank Mr. BalaTutor, who created these tutorials. Great Job Bala..! 


I hope it will be really helpful for the people who want to learn Linux and it can help Tamil Guys to understand Linux better.

Linux OS Image Backup & Restore Guide (Using PING Tool)

By Parthiban Ponnusamy

Using PING for backup and Restore Linux OS Images

PING (Ping is not Ghost) is a live Linux ISO, created to take image backups of HDD/partitions, either locally or over the network. It can be burnt on a CD and booted, or integrated into a PXE / RIS environment.


Its a good idea to take an image backup of all the servers. so that, if something goes wrong, we can restore easily.


Look at the Quick HOWTO Guide for Backup and Restore Linux Images using PING Tool


Download PING from here

Hope this Article will help System Admins. Using PING you can take image backup of Linux and Windows Operating Systems.

Find WWN and WWPN in Linux

By Parthiban Ponnusamy

How to find WWN and WWPN in Linux?

First let us check, how many HBAs are available on the sever?

mytestsrv1# ls /sys/class/fc_host/
host0  host1

Or you can try the following method as well,

#lspci 
....
....

....
07:0a.0 Fibre Channel: Emulex Corporation Helios LightPulse Fibre Channel Host Adapter (rev 01)
08:0b.0 Fibre Channel: Emulex Corporation Helios LightPulse Fibre Channel Host Adapter (rev 01)

We have Two HBA here from the above example (host0 and host1).

To get the WWNN (World Wide Node Number) in Linux:

mytestsrv1#  cat /sys/class/fc_host/host0/node_name
0x20000000c9538d83

mytestsrv1# cat /sys/class/fc_host/host1/node_name
0x20000000c9538dac

To get the WWPN (World Wide Port Number) in Linux:

mytestsrv1#  cat /sys/class/fc_host/host0/port_name0x10000000c9538d83mytestsrv1#  cat /sys/class/fc_host/host1/port_name0x10000000c9538dac

If you have more HBAs, replace "host0 or host1" with "hostN ". In most cases, System admins need to provide the WWPN to storage admins for the storage allocation.

Upgrade iLO firmware from Linux shell

By Parthiban Ponnusamy


You can upgrade the iLO firmware from the Linux shell itself.
1. Download the right firmware version from HP site and upload it to the server which you want to upgrade.

2. Now login to the server and simply run the file which you downloaded from hp site.

mytestsrv1:/var/tmp # ./CP014890.scexe
FLASH_iLO2 v1.12 for Linux (Aug 31 2009)
Copyright 2009 Hewlett-Packard Development Company, L.P.
Firmware image: ilo2_206.bin
Current iLO 2 firmware version  2.01; Serial number ILOXXXXXXX
Component XML file: CP014890.xml
CP014890.xml reports firmware version 2.06
This operation will update the firmware on the
iLO 2 in this server with version 2.06.
Continue (y/N)?y
Current firmware is 2.01 (Aug 04 2010 11:16:29)
Firmware image is 0x300000 bytes
Committing to flash part...
******** DO NOT INTERRUPT! ********
Flashing completed!
Attempting to reset device.
Succeeded.
Waiting for iLO 2 to reboot...
iLO 2 reboot completed. 

That's all. you are done. iLO firmware has been upgraded to newer version.


Video Tutorial: Understand Oracle RAC

By Parthiban Ponnusamy


Interview Questions and Answers - Linux Administrator - 2

By Parthiban Ponnusamy

What command can you use to review boot messages?
The dmesg command can be used to display the system messages during boot time.

What are the fields in the /etc/passwd file. Explain them?
There are 7 fields in /etc/passwd:

username:x:UID:GID:comment:home directory:shell

1)Username.
2)Password. Dummy value x denotes that its using shadow passwords
3)UID.
4)Primary group ID.
5)Comment /description.
6)Home directory path.
7)Shell assigned to the user.

Whats the journaling data contains in ext3? 

A journaled file system records information in a log area on a disk.   It logs the "metadata" i.e ownership, date stamp information etc..Once the log is updated the system then writes the actual data to the appropriate areas of the filesystem and marks an entry in the log to say the data is committed.

After a crash the filesystem can very quickly be brought back on-line using the journal logs 
using fsck there is considerably less chance of data loss or corruption.

How do u extend the LV in Linux?

First check whether is there free space available in the VG where the LV resides.

# vgdisplay or 
# vgs

Now, extend the LV using below command: "L" option to specify the size to be increased.

# lvextend -L +5G /dev/vg00/lv01

Finally, extend the File system space:

# resize2fs /dev/vg00/lv01
That's all..!  Look at the other posts as well for interview questions. I am posting 4-5 questions in every post whenever i get time.




Features Comparison: Ext3 vs Ext4

By Parthiban Ponnusamy

.
Here is the quick facts and comparison of Ext3 and Ext4 File systems:  Hope this helps..!


Features
Ext3
Ext4
Stands For
Ext3 stands for third extended file system.
Ext4 stands for fourth extended file system.
Introduced
It was introduced in 2001.
It was introduced in 2008.
Kernel Support
Supports from Linux Kernel 2.4.15
Supports from Linux Kernel 2.6.19
Maximum individual file size supported
Maximum individual file size can be from 16 GB to 2 TB
Maximum individual file size can be from 16 GB to 16 TB
Maximum file system size supported
Overall ext3 file system size can be from 2 TB to 32 TB
Overall maximum ext4 file system size is 1 EB (exabyte).
1 EB = 1024 PB (petabyte).
1 PB = 1024 TB (terabyte).
Maximum sub directories
Directory can contain a maximum of  32,000 subdirectories
Directory can contain a maximum of 64,000 subdirectories
Other Features
The main benefit of ext3 is that it allows journaling. 

Journaling has a dedicated area in the file system, where all the changes are tracked. When the system crashes, the possibility of file system corruption is less because of journaling.


There are three types of journaling available in ext3 file system.

Journal – Metadata and content are saved in the journal.

Ordered – Only metadata is saved in the journal. Metadata are journaled only after writing the content to disk. This is the default.

Writeback – Only metadata is saved in the journal. Metadata might be journaled either before or after the content is written to the disk.
In ext4, it supports journaling and also has the option of turning the journaling feature “off”.

Several other new features are introduced in ext4: multi block allocation, delayed allocation, Journal checksum, fast fsck and etc.

All you need to know is that these new features have improved the performance and reliability of the file system when compared to ext3.

Supports huge individual file size and overall file system size.

You convert ext2 to ext3 without having any data loss
You can also mount an existing ext3 fs as ext4 fs (without having to upgrade it).


Managing Emulex HBA with hbacmd

By Parthiban Ponnusamy

The Emulex hbacmd utility can be used to print lot of configuration and performance attributes and can be used to manage the HBA operations. 

To view performance metrics of HBA:

To view all available performance metrics, the hbacmd utility can be invoked with the “portstat” option and the WWPN to view:
 
# hbacmd PortStat 10:00:00:00:c9:49:28:47

Port Statistics for10:00:00:00:c9:49:28:47

Secs Since Last Reset : 21573
Exchange Count: 1308267
Responder Exchange Count: 363
TX Seq Count : 1315705
RX Seq Count : 6357365
TX Frame Count : 1336810
RX Frame Count : 161483066
TX Word Count : 31567104
RX Word Count : 3316320000
TX KB Count :123309
RX KB Count : 12954375
LIP Count : -1
NOS Count : 0
Error Frame Count : 0
Dumped Frame Count : -1
Link Failure Count : 1
Loss of Sync Count : 0
Loss of Signal Count : 0
Prim Seq Prot Err Count : 0
Invalid TX Word Count : 8
Invalid RX Frame CRC Cnt: 0


Resetting Emulex HBAs
 
On some situations, it may be necessary to reset an Emulex HBA to re-establish connectivity to fabric services.  To reset an adaptor with hbacmd, the WWPN is passed as an parameter:
# /usr/sbin/hbanyware/hbacmd Reset 10:00:00:00:c9:49:2c:b4
Reset HBA 10:00:00:00:c9:49:2c:b4

List all available HBAs:

To view all of the Emulex HBAs installed in a server, hbacmd can be invoked with the “listhbas” option:
# hbacmd listhbas

Manageable HBA List

Port WWN   : 10:00:00:00:c9:49:28:42
Node WWN   : 20:00:00:00:c9:49:28:42
Fabric Name: 10:00:00:60:69:80:2d:ee
Flags      : 8000f980
Host Name  : server01
Mfg        : Emulex Corporation

Port WWN   : 10:00:00:00:c9:49:28:47
Node WWN   : 20:00:00:00:c9:49:28:47
Fabric Name: 10:00:00:60:69:80:0e:fc
Flags      : 8000f980
Host Name  : fraudmgmt01
Mfg        : Emulex Corporation

Get HBA and Port Attributes:

To list firmware versions, serial numbers, WWN and a variety of model specific information, the hbacmd can be invoked with the “hbaattrib” option and the WWN to probe:
# hbacmd HBAAttrib 10:00:00:00:c9:49:28:47

HBA Attributes for 10:00:00:00:c9:49:28:47

Host Name      : server01
Manufacturer   : Emulex Corporation
Serial Number  : MS51403247
Model          : LP9802
Model Desc     : Emulex LightPulse LP9802 2 Gigabit PCI Fibre Channel Adapter
Node WWN       : 20 00 00 00 c9 49 28 47
Node Symname   : Emulex LP9802 FV1.91A1 DV6.02f
HW Version     : 2003806d
Opt ROM Version: 1.50a4
FW Version     : 1.91A1 (H2D1.91A1)
Vender Spec ID : 80F9
Number of Ports: 1
Driver Name    : lpfc
Device ID      : F980
HBA Type       : LP9802
Operational FW : SLI-2 Overlay
SLI1 FW        : SLI-1 Overlay 1.91a1
SLI2 FW        : SLI-2 Overlay 1.91a1
IEEE Address   : 00 00 c9 49 28 47
Boot BIOS      : Fcode Firmware1.50a4
Driver Version : 6.02f; HBAAPI(I) v2.0.e, 11-07-03

To view host Port information (e.g., port speed, device paths) and fabric parameters (e.g., fabric ID (S_ID), number of ports zoned along with this port), hbacmd can be invoked with the “portattrib” option:
# hbacmd PortAttrib 10:00:00:00:c9:49:28:47

Port Attributes for 10:00:00:00:c9:49:28:47

Node WWN            : 20 00 00 00 c9 49 28 47
Port WWN            : 10 00 00 00 c9 49 28 47
Port Symname        :
Port FCID           : 6D0900
Port Type           : Fabric
Port State          : Operational
Port Service Type   : 6
Port Supported FC4  : 00 00 01 20 00 00 00 01
                      00 00 00 00 00 00 00 00
                      00 00 00 00 00 00 00 00
                      00 00 00 00 00 00 00 00
Port Active FC4     : 00 00 01 20 00 00 00 01
                      00 00 00 00 00 00 00 00
                      00 00 00 00 00 00 00 00
                      00 00 00 00 00 00 00 00
Port Supported Speed: 2 GBit/sec.
Port Speed          : 2 GBit/sec.
Max Frame Size      : 2048
OS Device Name      : /devices/pci@84,2000/lpfc@1
Num Discovered Ports: 3
Fabric Name         : 10 00 00 60 69 80 0e fc

Emulex is providing lot of CLI and GUI management utilites to manage HBA's. Hope this helps..!

Getting Information about Hard disk : Linux HOWTO

By Parthiban Ponnusamy


Getting Information about the Hard drive in Linux:

# hdparm /dev/sda


/dev/sda:
multcount    = 16 (on)
IO_support   =  0 (default 16-bit)
unmaskirq    =  0 (off)
using_dma    =  1 (on)
keepsettings =  0 (off)
readonly     =  0 (off)
readahead    = 256 (on)
geometry     = 16383/255/63, sectors = 234375000, start = 0

Add the -i option for more information:

# hdparm -i /dev/sda

/dev/sda:

Model=IC35L120AVV207-1, FwRev=V24OA66A, SerialNo=VNVD09G4CZ6E0T
Config={ HardSect NotMFM HdSw>15uSec Fixed DTR>10Mbs }
RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=52
BuffType=DualPortCache, BuffSize=7965kB, MaxMultSect=16, MultSect=16
CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=234375000
IORDY=on/off, tPIO={min:240,w/IORDY:120}, tDMA={min:120,rec:120}
PIO modes:  pio0 pio1 pio2 pio3 pio4
DMA modes:  mdma0 mdma1 mdma2
UDMA modes: udma0 udma1 udma2 udma3 udma4 *udma5
AdvancedPM=yes: disabled (255) WriteCache=enabled
Drive conforms to: SATA T13 1410D revision 3a:  2 3 4 5 6

How fast is your drive? 


# hdparm -tT /dev/hda

/dev/sda:
Timing buffer-cache reads:   128 MB in  0.41 seconds =315.32 MB/sec
Timing buffered disk reads:  64 MB in  1.19 seconds = 53.65 MB/sec 


Need to find your device? 


# mount
or
# cat /proc/partitions
or
# dmesg | egrep '^sd'

sda: IC35L120AVV207-1, SATA DISK drive
sdc: Lite-On LTN486S 48x Max, ATAPI CD/DVD-ROM drive
sda: max request size: 1024KiB
sda: 234375000 sectors (120000 MB) w/7965KiB Cache, CHS=16383/255/63, UDMA(100)

Finally, if you want to turn on DMA: 


# hdparm -d1 /dev/sda

setting using_dma to 1 (on)
using_dma    =  1 (on)

See other users SSH sessions in Linux

By Parthiban Ponnusamy

Are wondering what your users are doing in their SSH sessions? Do you want to see, whats happening there?

Try the following:
# cat /dev/vcs1
This will show you what happenening on the first console. If someone is typing, you’ll be able to get an output of their keystrokes.

Note: You should have "root" access for this.

Replace /dev/vcs1 with /dev/vcs2 or /dev/vcs3 and so on for other consoles.

Enjoy..!


Limit SSH Access for Users

By Parthiban Ponnusamy

How do you limit the access to the SSH for different users in Linux server?

We can use “Match” in the OpenSSH configuration file. Add the Match directive in your sshd_config followed by a criteria which you want to block (User, Group, Address or Host).

The following example limits TCP and X11 port forwarding for the user "testuser":

AllowTcpForwarding no

X11Forwarding no

Match User jack

AllowTcpForwarding yes

X11Forwarding yes

Hope this helps..!

Understanding TOP command ouput in Linux

By Parthiban Ponnusamy


How do I determine CPU and Memory utilization, based on running processes in Linux using TOP?
Top command provides a real-time look at what is happening with your system. Top produces so much output that a new user may get over whelmed with all that’s presented and what it means.
Let’s take a look at TOP one line at a time.

The first line in top:
top - 22:09:08 up 14 min,  1 user,  load average: 0.21, 0.23, 0.30
“22:09:08″ is the current time; “up 14 min” shows how long the system has been up for; “1 user” how many users are logged in; “load average: 0.21, 0.23, 0.30″ the load average of the system (1minute, 5 minutes, 15 minutes).
Load average is an extensive topic and to understand its inner workings can be daunting. The simplest of definitions states that load average is the cpu utilization over a period of time. A load average of 1 means your cpu is being fully utilized and processes are not having to wait to use a CPU. A load average above 1 indicates that processes need to wait and your system will be less responsive. If your load average is consistently above 3 and your system is running slow you may want to upgrade to more CPU’s or a faster CPU.
The second line in top:
Tasks:  82 total,   1 running,  81 sleeping,   0 stopped,   0 zombie
Shows the number of processes and their current state.
The third line in top:
Cpu(s):  9.5%us, 31.2%sy,  0.0%ni, 27.0%id,  7.6%wa,  1.0%hi, 23.7%si,  0.0%st
Shows CPU utilization details. “9.5%us” user processes are using 9.5%; “31.2%sy” system processes are using 31.2%; “27.0%id” percentage of available cpu; “7.6%wa” time CPU is waiting for IO.
When first analyzing the Cpu(s) line in top look at the %id to see how much cpu is available. If %id is low then focus on %us, %sy, and %wa to determine what is using the CPU.
The fourth and fifth lines in top:
Mem:    255592k total,   167568k used,    88024k free,    25068k buffers
Swap:   524280k total,        0k used,   524280k free,    85724k cached
Describes the memory usage. These numbers can be misleading. “255592k total” is total memory in the system; “167568K used” is the part of the RAM that currently contains information; “88024k free” is the part of RAM that contains no information; “25068K buffers and 85724k cached” is the buffered and cached data for IO.
So what is the actual amount of free RAM available for programs to use ?
The answer is: free + (buffers + cached)
88024k + (25068k + 85724k) = 198816k
How much RAM is being used by progams ?
The answer is: used – (buffers + cached)
167568k – (25068k + 85724k) = 56776k
The processes information:
Top will display the process using the most CPU usage in descending order. Lets describe each column that represents a process.
 PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
3166 apache    15   0 29444 6112 1524 S  6.6  2.4   0:00.79 httpd
PID – process ID of the process
USER – User who is running the process
PR – The priority of the process
NI – Nice value of the process (higher value indicates lower priority)
VIRT – The total amount of virtual memory used
RES – Resident task size
SHR – Amount of shared memory used
S – State of the task. Values are S (sleeping), D (uninterruptible sleep), R (running), Z(zombies), or (stopped or traced)
%CPU – Percentage of CPU used
%MEM – Percentage of Memory used
TIME+ – Total CPU time used
COMMAND – Command issued
Interacting with TOP
Now that we are able to understand the output from TOP lets learn how to change the way the output is displayed.
Just press the following key while running top and the output will be sorted in real time.

M – Sort by memory usage
P – Sort by CPU usage
T – Sort by cumulative time
z – Color display
k – Kill a process
q – quit
If we want to kill the process with PID 3161, then press “k” and a prompt will ask you for the PID number, and enter 3161.
Command Line Parameters with TOP
You can control what top displays by issuing parameters when you run top.
- d – Controls the delay between refreshes
- p – Specify the process by PID that you want to monitor
-n – Update the display this number of times and then exit
If we want to only monitor the http process with a PID of 3166
$ top -p 3166
If we want to change the delay between refreshes to 5 seconds
$ top -d 5

Extend SAN disk under Linux LVM

By Parthiban Ponnusamy

In Linux server, How to extend the SAN disk under LVM , after the LUN expanded from SAN? 

This article will explain you, how to do this. we are going to expand size of the SAN disk which is 20GB to 75GB under LVM. Basically, Linux detects the new size after a LUN scan, but LVM won't recognize expanded size of the disk. Let us see, how we are going to achieve this.

1. Scan for new LUNS. Refer Scan and Configure New LUNS for scanning LUNS in Linux

2. After scanning, check physical size of  the drive now.

# fdisk -l /dev/sdb
       
Disk /dev/sdb: 75.1 GB, 75161927680 bytes
255 heads, 63 sectors/track, 9137 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
Device Boot      Start         End      Blocks   Id  System

Now,  Linux recognized the new size as 75 GB.

3. Check the LVM

# pvs   
PV         VG      Fmt  Attr PSize  PFree
/dev/sda3  system  lvm2 a-   16.89G  2.92G
/dev/sdb   system2 lvm2 a-   20.00G 96.00M

 This command still reported 20GB for the LVM disk, Lets do a scan now:

# pvscan
# vgscan
# lvscan

# pvs   
PV         VG      Fmt  Attr PSize  PFree
/dev/sda3  system  lvm2 a-   16.89G  2.92G
/dev/sdb   system2 lvm2 a-   20.00G 96.00M

4. After the scan also, LVM still reports the disk as 20GB. So let us extend the size manually.
       

#  pvresize --setphysicalvolumesize 70G /dev/sdb
#  pvs

PV            VG      Fmt  Attr PSize  PFree
/dev/sda3  system  lvm2 a-   16.89G  2.92G
/dev/sdb   system2 lvm2 a-   70.00G 96.00M

Now LVM reports the new size of the disk.  Let us do a scan again, so that VG takes this new PV size into account.

# pvscan
# vgscan
# lvscan

5. Now, we can extend the logical volume size:

#  lvextend -L +50G /dev/system2/app
#  resize_reiserfs /dev/system2/app

# pvs
# vgs
VG      #PV #LV #SN Attr   VSize  VFree
system    1   5   0 wz--n- 16.89G  2.92G
system2   1   1   0 wz--n- 70.00G 96.00M

# lvs
LV   VG      Attr   LSize  Origin Snap%  Move Log Copy%
Opt  system  -wi-ao  2.00G
root system  -wi-ao  1.00G
tmp  system  -wi-ao  2.00G
usr  system  -wi-ao  2.97G
var  system  -wi-ao  6.00G
app  system2 -wi-a- 69.90G
       
6. Finally verify the space

# df -h  /app
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/system2-app
                           70G  5.5G   65G   8% /app
Thats all..! we are done..enjoy..