Thursday, December 5, 2013

Checking the HBA card on the server if it is communicating with storage device.


Q. Following complain got from storage team.
HBA cards on the Hosts dcapplx202 is not logged in to the switch dc2sansw55. Looks like either cable or card has a problem.
The WWN of the HBA card that's not logged in is 10000000c99eab1c.

Solution,
Run the systool command and see if the link shows down. If it is down, go to datacenter if you can easily access or ask someone on remote site to check it for you.
Check the value of port_state, if you see port_state = "Linkdown" then cable might be loose or might not be connected correctly.

[root@dcapplx202 ~]# systool -c fc_host -v
Class = "fc_host"
  Class Device = "host3"
  Class Device path = "/sys/class/fc_host/host3"
    active_fc4s         = "0x00 0x00 0x01 0x00 0x00 0x00 0x00 0x01 0x00 0x00 0x0                                                                                                                     0 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0                                                                                                                     0 0x00 0x00 0x00 0x00 0x00 "
    fabric_name         = "0x0"
    issue_lip           = <store method only>
    maxframe_size       = "2048 bytes"
    node_name           = "0x20000000c99eab1c"
    port_id             = "0x019000"
    port_name           = "0x10000000c99eab1c"
    port_state          = "Linkdown"
    port_type           = "Unknown"
    speed               = "unknown"
    supported_classes   = "Class 3"
    supported_fc4s      = "0x00 0x00 0x01 0x00 0x00 0x00 0x00 0x01 0x00 0x00 0x0                                                                                                                     0 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0                                                                                                                     0 0x00 0x00 0x00 0x00 0x00 "
    supported_speeds    = "2 Gbit, 4 Gbit, 8 Gbit"
    tgtid_bind_type     = "wwpn (World Wide Port Name)"
    uevent              = <store method only>
    Device = "host3"
    Device path = "/sys/devices/pci0000:00/0000:00:04.0/0000:17:00.0/0000:18:02.                                                                                                                     0/0000:22:00.0/host3"
      uevent              = <store method only>

  Class Device = "host4"
  Class Device path = "/sys/class/fc_host/host4"
    active_fc4s         = "0x00 0x00 0x01 0x00 0x00 0x00 0x00 0x01 0x00 0x00 0x0                                                                                                                     0 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0                                                                                                                     0 0x00 0x00 0x00 0x00 0x00 "
    fabric_name         = "0x100000051eb60f80"
    issue_lip           = <store method only>
    maxframe_size       = "2048 bytes"
    node_name           = "0x20000000c99e1c96"
    port_id             = "0x019000"
    port_name           = "0x10000000c99e1c96"
    port_state          = "Online"
    port_type           = "NPort (fabric via point-to-point)"
    speed               = "8 Gbit"
    supported_classes   = "Class 3"
    supported_fc4s      = "0x00 0x00 0x01 0x00 0x00 0x00 0x00 0x01 0x00 0x00 0x0                                                                                                                     0 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0                                                                                                                     0 0x00 0x00 0x00 0x00 0x00 "
    supported_speeds    = "2 Gbit, 4 Gbit, 8 Gbit"
    tgtid_bind_type     = "wwpn (World Wide Port Name)"
    uevent              = <store method only>
    Device = "host4"
    Device path = "/sys/devices/pci0000:00/0000:00:04.0/0000:17:00.0/0000:18:01.                                                                                                                     0/0000:25:00.0/host4"
      uevent              = <store method only>

[root@dcapplx202 ~]#

Thursday, October 3, 2013

Configure network service on your system.

Configure network service on your system.
You can configure your network setting using DHCP or Static.

A. DHCP Configuration

# vi  /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE="eth0"
BOOTPROTO="dhcp"
HWADDR="C8:60:00:DD:B8:E6"
NM_CONTROLLED="yes"
ONBOOT="yes"

or for wireless set up,

[root@my32GB ~]# vi /etc/sysconfig/network-scripts/ifcfg-wlan0
DEVICE="wlan0"
BOOTPROTO="dhcp"
HWADDR="94:DB:C9:B4:D9:7B"
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Ethernet"
UUID="58c295da-67d8-4a85-8b0b-ee126775e3a9"


B. Assigning Static IP address
DEVICE="eth0"
IPADDR=192.168.10.125
NETMASK=255.255.255.0
HWADDR="C8:60:00:DD:B8:E6"
NM_CONTROLLED="yes"
ONBOOT="yes"
DNS1=192.168.10.1

# vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=sama.expanor.com
GATEWAY=192.168.10.1

Restart network service.
# service network restart

LUKS partition on Redhat 6.4

Configure a LUKS Encrypted Partition Redhat 6.4

1. Check to see if dm_crypt module is loaded on the system.
[root@my32GB ~]# lsmod | grep crypt
[root@my32GB ~]#

No value is returned so crypt module is not installed.

2. Load the module
[root@my32GB ~]# modprobe dm_crypt
[root@my32GB ~]# lsmod | grep crypt
dm_crypt               13022  0
dm_mod                 81692  3 dm_crypt,dm_mirror,dm_log
[root@my32GB ~]#

Configure to load the module across the reboot, create a simple script.

# vi /etc/sysconfig/modules/dm_crypt.modules

#!/bin/sh
modprobe dm_crypt

wq !
save the file at /etc/sysconfig/modules/dm_crypt.modules

# chmod 755 /etc/sysconfig/modules/dm_crypt.modules


3. Create a new partition
/dev/sdc ==>> /dev/sdc1

# dd if=/dev/zero of=/dev/sdc1 bc=512 count=10

Note: You don't have to use this option

4. Now, format the partition with encription
# cryptsetup luksFormat /dev/sdc1

Enter the pw:

Note: Please remember the pw.

5. Open the just formated partition
# cryptsetup luksOpen /dev/sdc1 myLuksFS

Enter your pw, you just created

6. device link is created to /dev/mapper as /dev/mapper/myLuksFS

Now, get the UUID of the device.
# cryptsetup luksUUID /dev/sdc1
ijBK8ZOz-Nn1r-mI4c-nu11-c6fNHfq6I7iC

You will see the return value. Note the value.

Now create a FS with type of your choice.
# mkfs.ext4 /dev/mapper/myLuksFS

7. Create a mount point and mount it.
# mkdir /myLuksFS
# mount /dev/mapper/myLuksFS /myLuksFS

8. To make it persistent across the reboot,  add entry to /etc/crypttab

# vi /etc/crupttab

myLuksFS    UUID=ijBK8ZOz-Nn1r-mI4c-nu11-c6fNHfq6I7iC

or
myLuksFS    /dev/sdc1

wq!

Note: Remember, you have to enter your password each time you reboot the system.
Make sure to have console connection while rebooting the system.

To open the encrypted volume enter the command,
# cryptsetup luksOpen /dev/sdc1 myLuksFS

9. Add entry to /etc/fstab
# vi /etc/fstab

/dev/mapper/myLuksFS    /myLuksFS    ext4    defaults    1    2

This will make sure that it mounts on reboot.



http://www.linuxexplorers.com/2012/03/how-to-configure-a-luks-encrypted-partition-in-red-hat-enterprise-linux-rhel-rhcsa-objective/

Tuesday, September 24, 2013

Install and configure VNC server on Redhat/CEntOS 6.x

Install and configure VNC server on Redhat/CEntOS 6.x

1. Install VNC server (Make sure your yum repo is set up).
# yum groupinstall Desktop
# yum install tigervnc-server
# yum install xorg-x11-fonts-Type1
# chkconfig vncserver on

2. Configure VNC access for each user.
# vi /etc/sysconfig/vncservers

VNCSERVERS="2:jay 3:dev 4:sam"
VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -localhost"

VNCSERVERARGS[3]="-geometry 800x600 -nolisten tcp -localhost"

VNCSERVERARGS[4]="-geometry 1024x600"

........ so on...

or

VNCSERVERS="2:jay"
VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -localhost"
VNCSERVERS="3:dev"
VNCSERVERARGS[3]="-geometry 800x600 -nolisten tcp -localhost"
VNCSERVERS="4:sam"
VNCSERVERARGS[4]="-geometry 1024x600"



Note:
- session 2 for Jay and session 3 for dev user is configured with screen size 800x600.
- If you don't specify nolisten and localhost option, you have to open a VNC port on firewall.
- With the use of these options, you will be using secure ssh port 22 with ssh tunel.

3. Create VNC password for users who want to access VNC server.
# su - jay
$ vncpasswd
Password:
Verify:
$
Now, set up vncpassword for rest of the users.

4. Restart VNC server.
# service vncserver status/start/restart

5. Connect to the VNC server.

$ vncviewer sama:2  (sama is a server name; hostname)

Enter your pw, and you should be able to login and session should start.

5.a. Enable firewall

# iptables -I INPUT 5 -m state --state NEW -m tcp -p tcp -m multiport --dports 5901:5903,6001:6003 -j ACCEPT
# service iptables save
# service iptables restart
# service vncserver restart

if fails,
kill the vnc server
$ vncserver -kill :2

$ vi .vnc/xstartup

Commentout the entry
#twn &
exec gnome-session &

Restart the VNC server
# service vncserver restart


Note: If the connection to the VNC server is without secure ssh tunnel, you have to configure your firewall to allow this vnc client connection.

If you are connecting VNC server through ssh tunnel

$ vncviewer -via jay@sama localhost:2

Enter your pw, your vnc session will start.

Connecting through your desktop

1. Download and install VNCViewer

http://www.realvnc.com/download/viewer/
http://sourceforge.net/projects/tigervnc/

2. Open the viewer and enter the server name: sama:4
Encription: Prefer off

and connect, it will prompt you for pw, enter your user name and the pw that you created using vncpasswd

3. To kill the VNCServer session,
$ vncserver -kill :4  (kill the session with whatever session that theuser belongs to )

Tuesday, September 3, 2013

Removing LVM disk


How to remove physical disk from the system and add new LUN
1. List Volume group
# vgs; pvs
2. Remove the device
# vgreduce dbdatavg DB004p1
3. Remove physical device
# pvremove DB004p1
4.



[root@mylnx200 mapper]# vgs
  VG       #PV #LV #SN Attr   VSize   VFree
  dbdatavg   5   2   0 wz--n- 809.17G 304.17G
  dblogvg    5   4   0 wz--n- 505.72G  65.72G
  system     1   3   0 wz--n-  84.44G  52.44G
[root@mylnx200 mapper]# pvs
  PV                 VG       Fmt  Attr PSize   PFree
  /dev/cciss/c0d0p5  system   lvm2 a--   84.44G  52.44G
  /dev/mpath/DB001p1 dbdatavg lvm2 a--  202.29G      0
  /dev/mpath/DB002p1 dbdatavg lvm2 a--  202.29G      0
  /dev/mpath/DB003p1 dbdatavg lvm2 a--  202.29G 101.88G
  /dev/mpath/LOG01p1 dblogvg  lvm2 a--  101.14G   1.14G
  /dev/mpath/LOG02p1 dblogvg  lvm2 a--  101.14G   1.14G
  /dev/mpath/LOG03p1 dblogvg  lvm2 a--  101.14G      0
  /dev/mpath/LOG04p1 dblogvg  lvm2 a--  101.14G  63.43G
  /dev/mpath/LOG05p1 dblogvg  lvm2 a--  101.14G      0
  DB004p1            dbdatavg lvm2 a--  101.14G 101.14G
  DB005p1            dbdatavg lvm2 a--  101.14G 101.14G
  DB006p1                     lvm2 a--  101.15G 101.15G
  DB007p1                     lvm2 a--  101.15G 101.15G
  DB008p1                     lvm2 a--  101.15G 101.15G

[root@mylnx200 mapper]# vgreduce  dbdatavg DB004p1
  Removed "DB004p1" from volume group "dbdatavg"
[root@mylnx200 mapper]# vgreduce dbdatavg DB005p1
  Removed "DB005p1" from volume group "dbdatavg"
[root@mylnx200 mapper]# pvremove DB004p1
  Labels on physical volume "DB004p1" successfully wiped
[root@mylnx200 mapper]# pvremove DB005p1
  Labels on physical volume "DB005p1" successfully wiped
[root@mylnx200 mapper]# pvremove DB006p1
  Labels on physical volume "DB006p1" successfully wiped
[root@mylnx200 mapper]# pvremove DB007p1
  Labels on physical volume "DB007p1" successfully wiped
[root@mylnx200 mapper]# pvremove DB008p1
  Labels on physical volume "DB008p1" successfully wiped
[root@mylnx200 mapper]# pvs
  PV                 VG       Fmt  Attr PSize   PFree
  /dev/cciss/c0d0p5  system   lvm2 a--   84.44G  52.44G
  /dev/mpath/DB001p1 dbdatavg lvm2 a--  202.29G      0
  /dev/mpath/DB002p1 dbdatavg lvm2 a--  202.29G      0
  /dev/mpath/DB003p1 dbdatavg lvm2 a--  202.29G 101.88G
  /dev/mpath/LOG01p1 dblogvg  lvm2 a--  101.14G   1.14G
  /dev/mpath/LOG02p1 dblogvg  lvm2 a--  101.14G   1.14G
  /dev/mpath/LOG03p1 dblogvg  lvm2 a--  101.14G      0
  /dev/mpath/LOG04p1 dblogvg  lvm2 a--  101.14G  63.43G
  /dev/mpath/LOG05p1 dblogvg  lvm2 a--  101.14G      0

[root@mylnx200 mapper]# pvcreate /dev/mapper/DB004p1
  Writing physical volume data to disk "DB004p1"
  Physical volume "DB004p1" successfully created
[root@mylnx200 mapper]# pvcreate /dev/mapper/DB005p1
  Writing physical volume data to disk "DB005p1"
  Physical volume "DB005p1" successfully created
[root@mylnx200 mapper]# pvcreate /dev/mapper/DB006p1
  Writing physical volume data to disk "DB006p1"
  Physical volume "DB006p1" successfully created
[root@mylnx200 mapper]# pvs
  PV                 VG       Fmt  Attr PSize   PFree
  /dev/cciss/c0d0p5  system   lvm2 a--   84.44G  52.44G
  /dev/mpath/DB001p1 dbdatavg lvm2 a--  202.29G      0
  /dev/mpath/DB002p1 dbdatavg lvm2 a--  202.29G      0
  /dev/mpath/DB003p1 dbdatavg lvm2 a--  202.29G 101.88G
  /dev/mpath/LOG01p1 dblogvg  lvm2 a--  101.14G   1.14G
  /dev/mpath/LOG02p1 dblogvg  lvm2 a--  101.14G   1.14G
  /dev/mpath/LOG03p1 dblogvg  lvm2 a--  101.14G      0
  /dev/mpath/LOG04p1 dblogvg  lvm2 a--  101.14G  63.43G
  /dev/mpath/LOG05p1 dblogvg  lvm2 a--  101.14G      0
  DB004p1                     lvm2 a--  101.15G 101.15G
  DB005p1                     lvm2 a--  101.15G 101.15G
  DB006p1                     lvm2 a--  101.15G 101.15G
[root@mylnx200 mapper]# pvcreate /dev/mapper/DB007p1
  Writing physical volume data to disk "DB007p1"
  Physical volume "DB007p1" successfully created
[root@mylnx200 mapper]# pvcreate /dev/mapper/DB008p1
  Writing physical volume data to disk "DB008p1"
  Physical volume "DB008p1" successfully created
[root@mylnx200 mapper]# pvs
  PV                 VG       Fmt  Attr PSize   PFree
  /dev/cciss/c0d0p5  system   lvm2 a--   84.44G  52.44G
  /dev/mpath/DB001p1 dbdatavg lvm2 a--  202.29G      0
  /dev/mpath/DB002p1 dbdatavg lvm2 a--  202.29G      0
  /dev/mpath/DB003p1 dbdatavg lvm2 a--  202.29G 101.88G
  /dev/mpath/LOG01p1 dblogvg  lvm2 a--  101.14G   1.14G
  /dev/mpath/LOG02p1 dblogvg  lvm2 a--  101.14G   1.14G
  /dev/mpath/LOG03p1 dblogvg  lvm2 a--  101.14G      0
  /dev/mpath/LOG04p1 dblogvg  lvm2 a--  101.14G  63.43G
  /dev/mpath/LOG05p1 dblogvg  lvm2 a--  101.14G      0
  DB004p1                     lvm2 a--  101.15G 101.15G
  DB005p1                     lvm2 a--  101.15G 101.15G
  DB006p1                     lvm2 a--  101.15G 101.15G
  DB007p1                     lvm2 a--  101.15G 101.15G
  DB008p1                     lvm2 a--  101.15G 101.15G
[root@mylnx200 mapper]#

Friday, May 24, 2013

List open files

List open files on linux

[root@he3lxvd596 /]# lsof | grep "/opt/dev" | more
startWebL  6310     appdata    1w      appdata              253,3      8467     310344 /opt/dev/mf/MSIRR/MSIRRDevDomain/startAServer.log (deleted)
startWebL  6310     appdata    2w      appdata              253,3      8467     310344 /opt/dev/mf/MSIRR/MSIRRDevDomain/startAServer.log (deleted)
startWebL  6349  mfstmgr2    1w      appdata              253,3     18025     310345 /opt/dev/mf/MarsIL/MarsILPerfDomain/startAServer.log (deleted)
startWebL  6349  mfstmgr2    2w      appdata              253,3     18025     310345 /opt/dev/mf/MarsIL/MarsILPerfDomain/startAServer.log (deleted)
java       6485     appdata    1w      appdata              253,3      8467     310344 /opt/dev/mf/MSIRR/MSIRRDevDomain/startAServer.log (deleted)
java       6485     appdata    2w      appdata              253,3      8467     310344 /opt/dev/mf/MSIRR/MSIRRDevDomain/startAServer.log (deleted)
java       6485     appdata  268w      appdata              253,3    349683     310505 /opt/dev/mf/MSIRR/MSIRRDevDomain/MSIRRDevAServer/MSIRRDevAServer.log
java       6485     appdata  281w      appdata              253,3         0     310346 /opt/dev/mf/MSIRR/MSIRRDevDomain/MSIRRDevAServer/access.log (deleted)
java       6486  mfstmgr2    1w      appdata              253,3     18025     310345 /opt/dev/mf/MarsIL/MarsILPerfDomain/startAServer.log (deleted)
java       6486  mfstmgr2    2w      appdata              253,3     18025     310345 /opt/dev/mf/MarsIL/MarsILPerfDomain/startAServer.log (deleted)
java       6486  mfstmgr2  264w      appdata              253,3    647581     326406 /opt/dev/mf/MarsIL/MarsILPerfDomain/MarsILPerfAServer/MarsILPerfAServer.log
java       6486  mfstmgr2  288w      appdata              253,3         0     326414 /opt/dev/mf/MarsIL/MarsILPerfDomain/MarsILPerfAServer/access.log (deleted)
startMana  7214     appdata    1w      appdata              253,3     40554     310347 /opt/dev/mf/MSIRR/MSIRRDevDomain/startMSIRRDevMServer1.log (deleted)
startMana  7214     appdata    2w      appdata              253,3     40554     310347 /opt/dev/mf/MSIRR/MSIRRDevDomain/startMSIRRDevMServer1.log (deleted)
startWebL  7220     appdata    1w      appdata              253,3     40554     310347 /opt/dev/mf/MSIRR/MSIRRDevDomain/startMSIRRDevMServer1.log (deleted)
startWebL  7220     appdata    2w      appdata              253,3     40554     310347 /opt/dev/mf/MSIRR/MSIRRDevDomain/startMSIRRDevMServer1.log (deleted)
java       7272     appdata    1w      appdata              253,3     40554     310347 /opt/dev/mf/MSIRR/MSIRRDevDomain/startMSIRRDevMServer1.log (deleted)
java       7272     appdata    2w      appdata              253,3     40554     310347 /opt/dev/mf/MSIRR/MSIRRDevDomain/startMSIRRDevMServer1.log (deleted)
java       7272     appdata  270w      appdata              253,3    339779     310594 /opt/dev/mf/MSIRR/MSIRRDevDomain/MSIRRDevMServer1/MSIRRDevMServer1.log
java       7272     appdata  287w      appdata              253,3         0     310349 /opt/dev/mf/MSIRR/MSIRRDevDomain/MSIRRDevMServer1/access.log (deleted)
java       7272     appdata  290r      appdata              253,3     78395     310223 /opt/dev/mf/MSIRR/MSIRRDevDomain/log4j_invrpt.log
startMana 11820  mfstmgr2    1w      appdata              253,3   5156320     310272 /opt/dev/mf/MarsIL/MarsILPerfDomain/startMarsILPerfMServer1.log
startMana 11820  mfstmgr2    2w      appdata              253,3   5156320     310272 /opt/dev/mf/MarsIL/MarsILPerfDomain/startMarsILPerfMServer1.log
--More--

Thursday, April 25, 2013

Rsync:- sing rsync for migration


rsync on the same server,
tested on Linux
-n, --dry-run - perform a trial run with no changes made

rsync --avx --dry-run --exclude=/lost+found/ /opt/satle/ /opt/satle/ 2>&1>/var/tmp/myrsynclog.out &
/usr/bin/rsync -avx --exclude=/lost+found/ /opt/satle/ /opt/satle/ 2>&1 >/var/tmp/rsync_oracle1.out &

To different host
tested on solaris,
#!/bin/ksh
/usr/bin/rsync -logtprz --exclude-from=/var/tmp/rsync.exclude --progress --rsync-path="sudo rsync" --rsh='ssh -l jay' /opt/satle/ jay@sama:/opt/satle/
/usr/bin/rsync -logtprz --exclude-from=/var/tmp/rsync.exclude --progress --rsync-path="sudo rsync" --rsh='ssh -l jay' /opt/satle/ jay@sama:/opt/satle/
Include the directories that you don't want to rsync.
# cat var/tmp/rsync.exclude
/myexcldir/
/myedir/