Resizing Online Multipath Disk in Linux

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:
Check your Disk Changes detected under LVM:
#pvs or pvdisplay 
To check the VG Size is Increased:
#vgs or vgdisplay
Now Extend the LV: 
Finally Extend the File System
#resize2fs <LV_NAME>

Thats all. You are done 

Windows server 2008 standard Edition Limit support

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

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

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)
   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

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
        ip_port = 7777
        ip_address =
        number = 0
        name = rac-cluster
        cluster = ocfs2
        ip_port = 7777
        ip_address =
        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
-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

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:~ $