UnixPedia : HPUX / LINUX / SOLARIS: June 2013

Friday, June 21, 2013

HPUX : Root disk replacement in 11.31 version.

  1.  

#Login as root and start a scriptlog.

 

script -a /var/adm/install-logs/IQ-mirror-rootdisk.scriptlog

# Step 1

uname -a

id

 

  1.  

#Find your second root disk.

#Set the variable MIRROR_DISK, with the short name of the entire disk (eg, #disk3, but not /dev/disk/disk3 or disk3_p2)

 

#Step 2

vgdisplay -v vg00|grep ‘PV Name’

ioscan -funNC disk | more

MIRROR_DISK=<short name of the entire disk, not a partition, eg. disk3. DO NOT USE THE FULL NAME.>

echo ${MIRROR_DISK}

 

  1.  

#Ensure the MIRROR_DISK is set correctly, as expected by this checklist.

 

#Step 3

ll /dev/disk/${MIRROR_DISK}   #No errors should be reported and device file for ENTIRE disk shown.

 

  1.  

# Determine the HW path of the disk, using the MIRROR_DISK variable

 

#Step 4

MIRROR_HW=`ioscan -m lun /dev/disk/${MIRROR_DISK}|awk '{if ( NR == 4 ) print $1}'`

echo $MIRROR_HW         #The Hardware path of the disk should be displayed.

 

ioscan -m hwpath -H $MIRROR_HW    #The lun h/w path and lunpath h/w path displayed.


 

  1.  

#Create Partition description file and partition the disk.

 

#Step 5

echo "3\nEFI 500MB\nHPUX 100%\nHPSP 400MB" > /tmp/idf

cat /tmp/idf

idisk -f /tmp/idf -w /dev/rdisk/${MIRROR_DISK}

idisk /dev/rdisk/${MIRROR_DISK} | more

 

  1.  

#Create device files for the new partition.

 

#Step 6

insf -eC disk

ll /dev/rdisk/${MIRROR_DISK}_p[123]

ioscan -m lun /dev/rdisk/${MIRROR_DISK}_p3  

 

  1.  

#Format partition 2 as a bootable lvm disk and add to vg00.

 

#Step 7

pvcreate -B /dev/rdisk/${MIRROR_DISK}_p2

vgextend vg00 /dev/disk/${MIRROR_DISK}_p2

 

  1.  

#Place boot utilities in the boot area.

 

#Step 8

mkboot -e -l /dev/rdisk/${MIRROR_DISK}

 

  1.  

#Create autoboot file.

 

#Step 9

mkboot -a "hpux -lq" /dev/rdisk/${MIRROR_DISK}

 

  1.  

#Mirror the LVs in the same order in which they are placed in the primary. Change to “m 2” in lvextend command below, if this is a second mirror (third disk).

 

#Step 10

PRIMARY_DISK=`vgdisplay -v vg00|awk '/PV Name/ { print  $3 }'|head -1`

 

echo $PRIMARY_DISK

 

for lv in `pvdisplay -v $PRIMARY_DISK|awk '/current.*0000 $/ {print $3 }’`

do

  echo Mirroring $lv

  lvextend -m 1 $lv /dev/disk/${MIRROR_DISK}_p2

done

 

vgdisplay -v vg00|more

           


 

  1.  

#Update root volume group information and verify that the mirrored disk is displayed as a boot disk and that the boot, root, and swap logical volumes appear to be on both disks.

 

#Step 11

lvlnboot -R /dev/vg00

lvlnboot -v

 

  1.  

#Specify mirror disk as HA alternate boot device in nvram. Change the setboot otion in first command to “-a” if this is a second mirror (third disk).

 

#Step 12

setboot -h $MIRROR_HW

setboot -v

 

  1.  

#Add a line to /stand/bootconf for the new boot disk if required.

 

#Step 13

cat /stand/bootconf

echo "l /dev/disk/${MIRROR_DISK}_p2" >> /stand/bootconf

cat /stand/bootconf

 

  1.  

#copy the HPSP partition.

 

#Step 14

PRIMARY_HPSP=`echo $PRIMARY_DISK|sed 's/2$/3/'`

dd if=$PRIMARY_HPSP of=/dev/rdisk/${MIRROR_DISK}_p3 bs=64k conv=sync

 

efi_ls -d /dev/disk/${MIRROR_DISK}_p3 EFI/HP/DIAG/ODE

 

 

  1.  

#Reboot using this mirror to test. Interupt the boot process and select HA Alternate device to boot. Exit scirptlog if reboot cannot be scheduled immediately.

 

#Step 15

shutdown -ry 0 #Recommended. Interupt boot and select the HA Alternate (or alternate, if third mirror) to boot.

 

#OR

 

exit

 

Saturday, June 15, 2013

HPUX : how to redirect the sshd logging in a File

Changes which need to be done in sshd.config


# HostKeys for protocol version 2
#HostKey /opt/ssh/etc/ssh_host_rsa_key
#HostKey /opt/ssh/etc/ssh_host_dsa_key

# Lifetime and size of ephemeral version 1 server key
#KeyRegenerationInterval 1h
#ServerKeyBits 768

# Logging
# obsoletes QuietMode and FascistLogging
SyslogFacility local7
LogLevel debug3




Changes which need to be done in syslogd.conf :



#-> vi /etc/syslog.conf
"/etc/syslog.conf" [Read only] 14 lines, 362 characters
# @(#)B11.23_LR
#
# syslogd configuration file.
#
# See syslogd(1M) for information about the format of this file.
#
mail.debug                      /var/adm/syslog/mail.log
local1.info                     @janapux1
local7.debug                    /var/adm/syslog/sshd.log             #(please do not use space bar use tab)
*.info;mail.none;local1.none;local7.none        /var/adm/syslog/syslog.log
*.alert                         /dev/console
*.alert                         root
*.emerg                         *
*.info  @10.153.53.39


---------------
#->  touch  /var/adm/syslog/sshd.log

restart the sshd and syslogd deamon from console.


#-> /sbin/init.d/secsh stop;/sbin/init.d/secsh start
#-> /sbin/init.d/syslogd stop ;/sbin/init.d/syslogd start





Friday, June 14, 2013

HPUX :HP Serviceguard Software - Procedure to Update Cluster When Changing LAN IP

HP Serviceguard Software - Procedure to Update Cluster When Changing LAN IP Addresses

Information
What is the procedure to update Serviceguard with new IP addresses?
Details
Serviceguard identifies IP addresses in the cluster configuration ASCII file, possibly one or more package configuration ASCII files and each legacy package control scripts where a relocatable IP is assigned. The cluster binary file distributed to all nodes is loaded with IP addresses identified in the configuration files when cmapplyconf completes successfully.
The cluster configuration file references fixed IPs, and the package configuration file references relocatable IPs that may be co-assigned to the same NICs as the fixed IPs. When changing an IP or set of IPs, determine which configuration file(s) must be updated and applied using cmapplyconf . Package control script modifications do not require cmapplyconf .
Note that cmapplyconf will validate the assignment of the new IPs to a NIC on each node, so it must be assigned to a NIC before cmapplyconf will succeed.
Every IP address defined in the cluster ASCII file that was used to create and distribute the cluster binary file (via cmapplyconf ) is stored in the cluster binary file (/etc/cmcluster/cmclconfig ). It is necessary to update the cluster binary when its IP addresses are changed.
When a cluster is created, each subnet has at least one fixed IP assigned to each node. Example content of a cluster configuration file:
NODE_NAME      eon   NETWORK_INTERFACE lan0     HEARTBEAT_IP    16.113.9.254 ---snipped--- NODE_NAME      ion   NETWORK_INTERFACE lan0     HEARTBEAT_IP    16.113.9.255
In this case, subnet 16.113.0.0 has an IP representative on eon (16.113.9.254 ) and a representative on ion (16.113.9.255 ). This document refers to this relationship as an IP set (*).
Changing IP addresses on a LAN NIC on the fly can interrupt transmission.
Although Serviceguard A.11.18-A.11.20 permits online IP reconfiguration, it is necessary to halt the cluster and perform IP changes for older versions of Serviceguard.
Unless the cluster operates as a cross-subnet cluster, changing one subnet/IP usually means changing the IP set*. Therefore, when changing IPs, expect to edit each node section in the cluster configuration ASCII file.
Also, changing a fixed IP may also require a change to a relocatable IP. Any package that relies on a relocatable IP related to a changed fixed IP must be updated with the new relocatable IP after the package is halted.
Updating a single subset of IPs across nodes:
Beginning with Serviceguard version A.11.19, it is possible to update an IP set while the cluster is running. (See limitations identified in the "Managing Serviceguard" manual.) Edit the cluster ASCII configuration file with the changes and perform cmapplyconf on the file. Note that any package that has a dependency on the IP/subnet must be modified at the same time, and the package cannot be running when the cmapplyconf is performed.
Beginning with Serviceguard version A.11.18, it is possible to remove an IP set (via editing the cluster ASCII file, and then cmapplyconf) and subsequently add an updated IP set while the cluster is running, assuming related relocatable IPs are not in use (packages are halted).
Earlier versions of Serviceguard require the cluster be halted if the cluster binary will be modified as a result of the change. The process requires 2 cmapplyconf commands. The first to remove the OLD NIC/IP set, and the 2nd to re-add the NETWORK_INTERFACE with its new IP.
If using a Serviceguard version earlier than A.11.18, determine whether downtime is necessary by using the following sort of command:
# cmviewconf | grep 10.X.X.17 (OLD IP)         ip address:                     10.X.X.17
If the ip address: line appears, then the IP is embedded in the cluster binary, requiring the cluster binary be updated with the new IP. If the subnet changes along with the IP, packages configuration files and control scripts that use that subnet must be updated as well.
Before proceeding, ensure /etc/cmcluster/cmclnodelist exists on each node, and lists every node in the cluster, much like a .rhosts file. Example:
nodeA   root nodeB   root
  1. Edit the cluster configuration file replacing the old IP with the new IP.
  2.   # cd /etc/cmcluster    # cmgetconf CLUSTER
  3. Edit the file, locate the lines containing the old IP(s) and update the IPs.
  4. The lines will look something like this:
  5.   NODE1      NETWORK_INTERFACE    lan0        HEARTBEAT_IP        10.X.X.17      NETWORK_INTERFACE    lan1      NETWORK_INTERFACE    lan2        HEARTBEAT_IP        192.X.X.1  
  6. Do the same for the other node's section.
  7. If the subnet for that LAN adapter changed, it is necessary to determine if package-related subnet parameters must be updated as well.
  8. # cmviewconf | grep -e "package name" -e "package subnet"       package name:                     clk       package subnet:                   10.X.X.0  <--- HERE    A.11.20: cmviewconf no longer exists.     Use 'cmviewcl -v -f line | grep package | grep subnet' to identify whether    packages have a dependency on subnets.   If the subnet will be modified, locate the package configuration file that   references the subnet.  In /etc/cmcluster:   # grep 10.X.X.0 */*   PKG_1/pkg.config:SUBNET                  10.X.X.0   PKG_1/pkg.ctrl:SUBNET[0]="10.X.X.0"  
  9. In the above case, only one package was affected and its files will have to be updated to reflect the new subnet. It may also require replacing old relocatable IPs with new ones and registering them on the name server.
  10. After updating the affected files, apply the updates to the cluster binary:
  11. # cmapplyconf -C CONF [ -P  ]
  12. When completed successfully, start the new cluster:
  13. # cmruncl
  14. Finally, test the package startup and shutdown on each server to be confident the change was performed properly.
Procedure to update multiple/all IP addresses in a cluster:
On one node:
  1. Use cmgetconf to create an up-to-date cluster configuration ASCII file and package configuration ASCII files.
  2. Verify the current configuration is viable:
  3. # cmcheckconf -C -P -P ...
  4. Halt the cluster: cmhaltcl .
  5. In the event that a new cluster must be built, decluster any VG used by the cluster:
  6. # vgchange -c n (repeat for each clustered VG).
  7. On each cluster node:
  8. Update /etc/cmcluster/cmclnodelist to identify each node.
  9. Edit /etc/rc.config.d/cmcluster , set AUTOSTART_CMCLD=0
  10. mv /etc/cmcluster/cmclconfig /etc/cmcluster/cmclconfig.old
  11. Update /etc/rc.config.d/netconf with the new IP/subnet mask for each NIC that will change.
  12. Edit/update /etc/hosts with the new IP addresses.
  13. On one node:
  14. Edit/update the cluster ASCII file with the new IP addresses assigned to each node.
  15. Edit/update any package configuration file that identifies a relocatable IP or SUBNET value with new values.
  16. Edit/update any package control script (legacy format) that identifies an old relocatable IP/SUBNET value with new values.
  17. Reboot both systems.
  18. On one node:
  19. cmapplyconf the cluster and package configuration ASCII files (using the
  20. custom command/script).
  21. Start the cluster: cmruncl .
  22. On each cluster node:
  23. Edit /etc/rc.config.d/cmcluster , set AUTOSTART_CMCLD=1 .
Changing a relocatable IP:
Altering a relocatable IP is a simple process but an IP must be selected that matches the new subnet of the LAN card it will be configured on.
Find and edit the legacy package control script or modular package configuration file under /etc/cmcluster that references the old relocatable IP.
An easy way to locate the script is to "grep" the last few digits of the IP in all files beneath /etc/cmcluster . Use cmviewcl -v -f line | grep to identify the package to update.
With the package down (cmhaltpkg ), edit the file with the replacement IP. When saved, copy this script to the other servers which also operate the package when necessary.

NOTE:
Online alteration of the relocatable IP is not advisable. Also, the relocatable IP must be propagated to the name server, whether /etc/hosts on each server, or DNS.
Again, test the package startup and shutdown on each server to be confident the change was performed properly.

Thursday, June 13, 2013

HPUX : how to remove/validate the limited state in ioscan.


ioscan -P health
ioscan -P health |grep -i offline

ioscan -m lun
disk 216  64000/0xfa00/0xd9 esdisk  CLAIMED DEVICE    limited  HP   OPEN-V
         0/2/1/0/4/0.0x50060e8005bf101a.0x40cd000000000000
         0/3/1/0/4/0.0x50060e8005bf103a.0x40cd000000000000
         0/6/1/0/4/0.0x50060e8005bf100a.0x40cd000000000000
         0/7/1/0/4/0.0x50060e8005bf102a.0x40cd000000000000
         0/3/1/0/4/0.0x50060e8005bf1039.0x40cd000000000000
         0/7/1/0/4/0.0x50060e8005bf1029.0x40cd000000000000
                  /dev/disk/disk216   /dev/rdisk/disk216


#-> scsimgr get_info all_lpt -D /dev/rdisk/disk216

    STATUS INFORMATION FOR LUN PATH : lunpath757

Generic Status Information

SCSI services internal state               = UNOPEN
Open close state                           = ACTIVE
Protocol                                   = fibre_channel
EVPD page 0x83 description code            = 1
EVPD page 0x83 description association     = 0
EVPD page 0x83 description type            = 3
World Wide Identifier (WWID)               = 0x60060e8005bf10000000bf100000536b
Total number of Outstanding I/Os           = 0
Maximum I/O timeout in seconds             = 30
Maximum I/O size allowed                   = 2097152
Maximum number of active I/Os allowed      = 16
Maximum queue depth                        = 16
Queue full delay count                     = 0
Asymmetric state                           = NA
Device preferred path                      = No
Relative target port identifier            = NA
Target port group identifier               = NA

    STATUS INFORMATION FOR LUN PATH : lunpath702

Generic Status Information

SCSI services internal state               = UNOPEN
Open close state                           = FAILED
Protocol                                   = fibre_channel
EVPD page 0x83 description code            = 1
EVPD page 0x83 description association     = 0
EVPD page 0x83 description type            = 3
World Wide Identifier (WWID)               = 0x60060e8005bf10000000bf100000536b
Total number of Outstanding I/Os           = 0
Maximum I/O timeout in seconds             = 30
Maximum I/O size allowed                   = 2097152
Maximum number of active I/Os allowed      = 16
Maximum queue depth                        = 16
Queue full delay count                     = 0
Asymmetric state                           = NA
Device preferred path                      = No
Relative target port identifier            = NA
Target port group identifier               = NA

    STATUS INFORMATION FOR LUN PATH : lunpath795

Generic Status Information

SCSI services internal state               = UNOPEN
Open close state                           = ACTIVE
Protocol                                   = fibre_channel
EVPD page 0x83 description code            = 1
EVPD page 0x83 description association     = 0
EVPD page 0x83 description type            = 3
World Wide Identifier (WWID)               = 0x60060e8005bf10000000bf100000536b
Total number of Outstanding I/Os           = 0
Maximum I/O timeout in seconds             = 30
Maximum I/O size allowed                   = 2097152
Maximum number of active I/Os allowed      = 16
Maximum queue depth                        = 16
Queue full delay count                     = 0
Asymmetric state                           = NA
Device preferred path                      = No
Relative target port identifier            = NA
Target port group identifier               = NA

    STATUS INFORMATION FOR LUN PATH : lunpath807

Generic Status Information

SCSI services internal state               = UNOPEN
Open close state                           = FAILED
Protocol                                   = fibre_channel
EVPD page 0x83 description code            = 1
EVPD page 0x83 description association     = 0
EVPD page 0x83 description type            = 3
World Wide Identifier (WWID)               = 0x60060e8005bf10000000bf100000536b
Total number of Outstanding I/Os           = 0
Maximum I/O timeout in seconds             = 30
Maximum I/O size allowed                   = 2097152
Maximum number of active I/Os allowed      = 16
Maximum queue depth                        = 16
Queue full delay count                     = 0
Asymmetric state                           = NA
Device preferred path                      = No
Relative target port identifier            = NA
Target port group identifier               = NA

    STATUS INFORMATION FOR LUN PATH : lunpath1527

Generic Status Information

SCSI services internal state               = UNOPEN
Open close state                           = ACTIVE
Protocol                                   = fibre_channel
EVPD page 0x83 description code            = 1
EVPD page 0x83 description association     = 0
EVPD page 0x83 description type            = 3
World Wide Identifier (WWID)               = 0x60060e8005bf10000000bf100000536b
Total number of Outstanding I/Os           = 0
Maximum I/O timeout in seconds             = 30
Maximum I/O size allowed                   = 2097152
Maximum number of active I/Os allowed      = 16
Maximum queue depth                        = 16
Queue full delay count                     = 0
Asymmetric state                           = NA
Device preferred path                      = No
Relative target port identifier            = NA
Target port group identifier               = NA

    STATUS INFORMATION FOR LUN PATH : lunpath1765

Generic Status Information

SCSI services internal state               = UNOPEN
Open close state                           = ACTIVE
Protocol                                   = fibre_channel
EVPD page 0x83 description code            = 1
EVPD page 0x83 description association     = 0
EVPD page 0x83 description type            = 3
World Wide Identifier (WWID)               = 0x60060e8005bf10000000bf100000536b
Total number of Outstanding I/Os           = 0
Maximum I/O timeout in seconds             = 30
Maximum I/O size allowed                   = 2097152
Maximum number of active I/Os allowed      = 16
Maximum queue depth                        = 16
Queue full delay count                     = 0
Asymmetric state                           = NA
Device preferred path                      = No
Relative target port identifier            = NA
Target port group identifier               = NA
[root@itwmdbp2:/.root]#



#-> cat >lunpath
0/2/1/0/4/0.0x50060e8005bf101a.0x40cd000000000000
0/3/1/0/4/0.0x50060e8005bf103a.0x40cd000000000000
0/6/1/0/4/0.0x50060e8005bf100a.0x40cd000000000000
0/7/1/0/4/0.0x50060e8005bf102a.0x40cd000000000000
0/3/1/0/4/0.0x50060e8005bf1039.0x40cd000000000000
0/7/1/0/4/0.0x50060e8005bf1029.0x40cd000000000000
#
#-> cat lunpath |while read i
> do
> ioscan -P health -H $i
> done
Class I  H/W Path  health
===============================
lunpath 757  0/2/1/0/4/0.0x50060e8005bf101a.0x40cd000000000000  online
Class I  H/W Path  health
===============================
lunpath 702  0/3/1/0/4/0.0x50060e8005bf103a.0x40cd000000000000  offline
Class I  H/W Path  health
===============================
lunpath 795  0/6/1/0/4/0.0x50060e8005bf100a.0x40cd000000000000  online
Class I  H/W Path  health
===============================
lunpath 807  0/7/1/0/4/0.0x50060e8005bf102a.0x40cd000000000000  offline
Class I  H/W Path  health
===============================
lunpath 1527  0/3/1/0/4/0.0x50060e8005bf1039.0x40cd000000000000  online
Class I  H/W Path  health
===============================
lunpath 1765  0/7/1/0/4/0.0x50060e8005bf1029.0x40cd000000000000  online
#



Check the target path in no-hw and we are sure that this can be removed.

#-> ioscan -kfNCtgtpath
Class I  H/W Path  Driver S/W State   H/W Type Description
=================================================================
tgtpath   9  0/2/1/0/4/0.0x50060e8005beef16  estp   CLAIMED TGT_PATH fibre_channel tgtpath   6  0/3/1/0/4/0.0x50060e8005bf103a  estp   NO_HW    TGT_PATH fibre_channel target served by fcd driver, target port id 0xea900
ttgtpath  18  0/5/1/0/4/0.0x500308c0020e8962  estp   CLAIMED TGT_PATH fibre_channel target served by fcd driver, target port id 0x54f900


tgtpath   8  0/7/1/0/4/0.0x50060e8005bf102a  estp   NO_HW    TGT_PATH fibre_channel target served by fcd driver, target port id 0xda900
tgtpath   4  64000/0x0/0x0.0x0            estp   CLAIMED TGT_PATH usb target served by usb_ms_scsi driver, target port id 0x0
#
#-> scsimgr get_attr -N /escsi/esdisk -a load_bal_policy

    SCSI ATTRIBUTES FOR SETTABLE ATTRIBUTE SCOPE : "/escsi/esdisk"

name = load_bal_policy
current = least_cmd_load
default = round_robin
saved = least_cmd_load

#
#-> rmsf -H 0/7/1/0/4/0.0x50060e8005bf102a