Sunday, May 27, 2012

Data protector : Too many disks have failed


Today got a ticket saying backup team is getting below error from Data protector while doing ZDB/BCV/Online backup.

[Major] From: SSEA@unixmemoirs01 ""  Time: 5/10/2012 21:11:39 AM
      Volume group /dev/vgdata3 has logical volume(s) with errors.
      Too many disks have failed.

The issue will be most probably from storage side. Here issue was logical volume was extended, but the new disk details not added in the BCV scripts.

Thursday, May 17, 2012

Detect tape drive after replacement HP-UX 11.31

There are two ways we can do this.

1. Complex way :)

root @ uxmemoirs01[/root]
#  ioscan -fnC tape
Class     I  H/W Path  Driver S/W State   H/W Type     Description
==================================================================
tape      0  3/0/12/1/0/4/0.36.17.255.0.0.0  stape   CLAIMED     DEVICE       HP      Ultrium 3-SCSI
                      /dev/rmt/0m             /dev/rmt/0mn            /dev/rmt/c23t0d0BEST    /dev/rmt/c23t0d0BESTn
                      /dev/rmt/0mb            /dev/rmt/0mnb           /dev/rmt/c23t0d0BESTb   /dev/rmt/c23t0d0BESTnb
tape      1  3/0/12/1/0/4/0.36.17.255.0.0.1  stape   CLAIMED     DEVICE       HP      Ultrium 3-SCSI
                      /dev/rmt/1m             /dev/rmt/1mn            /dev/rmt/c23t0d1BEST    /dev/rmt/c23t0d1BESTn
                      /dev/rmt/1mb            /dev/rmt/1mnb           /dev/rmt/c23t0d1BESTb   /dev/rmt/c23t0d1BESTnb
tape      5  3/0/14/1/0/4/0.35.17.255.0.0.1  stape   NO_HW       DEVICE       HP      Ultrium 3-SCSI
                      /dev/rmt/5m             /dev/rmt/5mn            /dev/rmt/c56t0d1BEST    /dev/rmt/c56t0d1BESTn
                      /dev/rmt/5mb            /dev/rmt/5mnb           /dev/rmt/c56t0d1BESTb   /dev/rmt/c56t0d1BESTnb
tape      6  3/0/14/1/0/4/0.35.17.255.0.0.2  stape   CLAIMED     DEVICE       HP      Ultrium 3-SCSI
                      /dev/rmt/6m             /dev/rmt/6mn            /dev/rmt/c56t0d2BEST    /dev/rmt/c56t0d2BESTn
                      /dev/rmt/6mb            /dev/rmt/6mnb           /dev/rmt/c56t0d2BESTb   /dev/rmt/c56t0d2BESTnb


Error in dmesg
class : lunpath, instance 332
Evpd inquiry page 83h/80h failed or the current page 83h/80h data do not match the previous known page 83h/80h data on LUN id 0x0 probed beneath the target path (class = tgtpath, instance = 28) The lun path is (class = lunpath, instance 332).Run 'scsimgr replace_wwid' command to validate the change

class : lunpath, instance 332
An attempt to probe existing LUN id 0x1000000000000 failed with errno of 14.

Get hardware path using Instance number

root @ uxmemiors01[/root]
# scsimgr -p get_attr -C lunpath -I 332 -a hw_path
3/0/14/1/0/4/0.0x100000e002235993.0x1000000000000

Get Lun H/W path , Lunpath H/W path, Legacy H/W path using above

root @ uxmemiors01[/root]
# ioscan -m hwpath -H 3/0/14/1/0/4/0.0x100000e002235993.0x1000000000000
Lun H/W Path      Lunpath H/W Path                 Legacy H/W Path
====================================================================
64000/0xfa00/0xa0
                  3/0/14/1/0/4/0.0x100000e002235993.0x1000000000000   3/0/14/1/0/4/0.35.17.255.0.0.1

Replace WWID using Lun H/W path

root @uxmemiors01[/root]
# scsimgr -f replace_wwid -H 64000/0xfa00/0xa0
scsimgr: Successfully validated binding of LUN paths with new LUN.

root @ uxmemiors01[/root]
# ioscan -fnC tape
Class     I  H/W Path  Driver S/W State   H/W Type     Description
==================================================================
tape      0  3/0/12/1/0/4/0.36.17.255.0.0.0  stape   CLAIMED     DEVICE       HP      Ultrium 3-SCSI
                      /dev/rmt/0m             /dev/rmt/0mn            /dev/rmt/c23t0d0BEST    /dev/rmt/c23t0d0BESTn
                      /dev/rmt/0mb            /dev/rmt/0mnb           /dev/rmt/c23t0d0BESTb   /dev/rmt/c23t0d0BESTnb
tape      1  3/0/12/1/0/4/0.36.17.255.0.0.1  stape   CLAIMED     DEVICE       HP      Ultrium 3-SCSI
                      /dev/rmt/1m             /dev/rmt/1mn            /dev/rmt/c23t0d1BEST    /dev/rmt/c23t0d1BESTn
                      /dev/rmt/1mb            /dev/rmt/1mnb           /dev/rmt/c23t0d1BESTb   /dev/rmt/c23t0d1BESTnb
tape      5  3/0/14/1/0/4/0.35.17.255.0.0.1  stape   CLAIMED     DEVICE       HP      Ultrium 3-SCSI
                      /dev/rmt/5m             /dev/rmt/5mn            /dev/rmt/c56t0d1BEST    /dev/rmt/c56t0d1BESTn
                      /dev/rmt/5mb            /dev/rmt/5mnb           /dev/rmt/c56t0d1BESTb   /dev/rmt/c56t0d1BESTnb
tape      6  3/0/14/1/0/4/0.35.17.255.0.0.2  stape   CLAIMED     DEVICE       HP      Ultrium 3-SCSI
                      /dev/rmt/6m             /dev/rmt/6mn            /dev/rmt/c56t0d2BEST    /dev/rmt/c56t0d2BESTn
                      /dev/rmt/6mb            /dev/rmt/6mnb           /dev/rmt/c56t0d2BESTb   /dev/rmt/c56t0d2BESTnb

root @ uxmemiors01[/root]



2. Simple way to accomplish the above

 Error in dmesg output

class : lunpath, instance 8
Evpd inquiry page 83h/80h failed or the current page 83h/80h data do not match the previous known page 83h/80h data on LUN id 0x0 probed beneath the target path (class = tgtpath, instance = 7) The lun path is (class = lunpath, instance 8).Run 'scsimgr replace_wwid' command to validate the change


# ioscan -fnC tape
Class     I  H/W Path  Driver S/W State   H/W Type     Description
==================================================================
tape      4  0/0/14/1/0/4/1.36.17.255.0.0.0  stape   CLAIMED     DEVICE       HP      Ultrium 3-SCSI
                      /dev/rmt/4m              /dev/rmt/4mn             /dev/rmt/c108t0d0BEST    /dev/rmt/c108t0d0BESTn
                      /dev/rmt/4mb             /dev/rmt/4mnb            /dev/rmt/c108t0d0BESTb   /dev/rmt/c108t0d0BESTnb
tape      5  0/0/14/1/0/4/1.36.17.255.0.0.1  stape   CLAIMED     DEVICE       HP      Ultrium 3-SCSI
                      /dev/rmt/5m              /dev/rmt/5mn             /dev/rmt/c108t0d1BEST    /dev/rmt/c108t0d1BESTn
                      /dev/rmt/5mb             /dev/rmt/5mnb            /dev/rmt/c108t0d1BESTb   /dev/rmt/c108t0d1BESTnb
tape      0  1/0/4/1/0/4/1.35.17.255.0.0.1   stape   NO_HW       DEVICE       HP      Ultrium 3-SCSI
                      /dev/rmt/0m             /dev/rmt/0mn            /dev/rmt/c19t0d1BEST    /dev/rmt/c19t0d1BESTn
                      /dev/rmt/0mb            /dev/rmt/0mnb           /dev/rmt/c19t0d1BESTb   /dev/rmt/c19t0d1BESTnb
tape      1  1/0/4/1/0/4/1.35.17.255.0.0.2   stape   CLAIMED     DEVICE       HP      Ultrium 3-SCSI
                      /dev/rmt/1m             /dev/rmt/1mn            /dev/rmt/c19t0d2BEST    /dev/rmt/c19t0d2BESTn
                      /dev/rmt/1mb            /dev/rmt/1mnb           /dev/rmt/c19t0d2BESTb   /dev/rmt/c19t0d2BESTnb


Replace wwid

# scsimgr -f replace_wwid -C lunpath -I 8
Binding of LUN path 1/0/4/1/0/4/1.0x100000e002235993.0x1000000000000 with new LUN validated successfully
# ioscan -fnC tape
Class     I  H/W Path  Driver S/W State   H/W Type     Description
==================================================================
tape      4  0/0/14/1/0/4/1.36.17.255.0.0.0  stape   CLAIMED     DEVICE       HP      Ultrium 3-SCSI
                      /dev/rmt/4m              /dev/rmt/4mn             /dev/rmt/c108t0d0BEST    /dev/rmt/c108t0d0BESTn
                      /dev/rmt/4mb             /dev/rmt/4mnb            /dev/rmt/c108t0d0BESTb   /dev/rmt/c108t0d0BESTnb
tape      5  0/0/14/1/0/4/1.36.17.255.0.0.1  stape   CLAIMED     DEVICE       HP      Ultrium 3-SCSI
                      /dev/rmt/5m              /dev/rmt/5mn             /dev/rmt/c108t0d1BEST    /dev/rmt/c108t0d1BESTn
                      /dev/rmt/5mb             /dev/rmt/5mnb            /dev/rmt/c108t0d1BESTb   /dev/rmt/c108t0d1BESTnb
tape      0  1/0/4/1/0/4/1.35.17.255.0.0.1   stape   CLAIMED     DEVICE       HP      Ultrium 3-SCSI
                      /dev/rmt/0m             /dev/rmt/0mn            /dev/rmt/c19t0d1BEST    /dev/rmt/c19t0d1BESTn
                      /dev/rmt/0mb            /dev/rmt/0mnb           /dev/rmt/c19t0d1BESTb   /dev/rmt/c19t0d1BESTnb
tape      1  1/0/4/1/0/4/1.35.17.255.0.0.2   stape   CLAIMED     DEVICE       HP      Ultrium 3-SCSI
                      /dev/rmt/1m             /dev/rmt/1mn            /dev/rmt/c19t0d2BEST    /dev/rmt/c19t0d2BESTn
                      /dev/rmt/1mb            /dev/rmt/1mnb           /dev/rmt/c19t0d2BESTb   /dev/rmt/c19t0d2BESTnb
#

Using kctune to change kernel paramaters


Changes that needs reboot

Normal output

# /usr/sbin/kctune ninode
Tunable  Value  Expression
ninode    8192  Default

Detailed output
# /usr/sbin/kctune -v ninode
Tunable             ninode
Description         Maximum number of HFS file system open inodes that can be in memory.
Module              ufs
Current Value       8192 [Default]
Value at Next Boot  Default (automatic)
Value at Last Boot  8192
Default Value       8192 (automatic)
Constraints         ninode >= 14
Can Change          At Next Boot Only

Changing the parameter

# /usr/sbin/kctune ninode=34816
NOTE:    The requested changes could not be applied to the currently
         running system, for the following reasons:
         - The tunable 'ninode' cannot be changed without a reboot.
       * The requested changes have been saved, and will take effect at
         next boot.
Tunable               Value  Expression
ninode   (now)         8192  Default
         (next boot)  34816  34816
# /usr/sbin/kctune ninode
Tunable               Value  Expression
ninode   (now)         8192  Default
         (next boot)  34816  34816


Changes that affects immediately without reboot

# /usr/sbin/kctune maxfiles_lim
Tunable       Value  Expression  Changes
maxfiles_lim   4096  Default     Immed

# /usr/sbin/kctune -v maxfiles_lim
Tunable             maxfiles_lim
Description         Hard maximum number of file descriptors per process
Module              fs
Current Value       4096 [Default]
Value at Next Boot  4096 [Default]
Value at Last Boot  4096
Default Value       4096
Constraints         maxfiles_lim >= 32
                    maxfiles_lim <= 1048576
                    maxfiles_lim >= maxfiles
Can Change          Immediately or at Next Boot


Changing the parameter

# /usr/sbin/kctune maxfiles_lim=63488
     ==> Update the automatic 'backup' configuration first? yes
       * The automatic 'backup' configuration has been updated.
       * Future operations will update the backup without prompting.
WARNING: The validity of the tunable values could not be completely
         verified, because the value of the tunable 'maxfiles' will not
         be known until the system is booted. The tunable values will be
         verified during boot. Please check the console messages during
         boot to see if there are any tunable value errors.
       * The requested changes have been applied to the currently
         running configuration.
Tunable                 Value  Expression  Changes
maxfiles_lim  (before)   4096  Default     Immed
              (now)     63488  63488
#

Monday, March 19, 2012

Difference between HP-UX EFI boot and PA-RISC boot

  Itanium-based System Hardware

  The Itanium-based system's bootstrap process involves the execution of   four software components:

           +  CMOS

           +  option ROM

           +  EFI

           +  Boot Manager

           +  hpux.efi

      After the processor is reset, firmware initializes and tests processors and platform.  During initialization, the firmware lets a user interrupt and configure CMOS and option ROMs.  It then transfers
 control to EFI, the Extensible Firmware Interface.  EFI, in turn,   initializes EFI boot and runtime services and launches the Boot Manager.  The Boot Manager, which allows loading of EFI application or       drivers from EFI defined file system, loads and transfers control to hpux.efi, the HP-UX-specific bootstrap loader.  hpux.efi then loads the HP-UX kernel object file from the HP-UX file system to memory and transfers control to the loaded kernel image.
  
  PA-RISC Hardware    

      The Series 700 and 800 bootstrap process involves the execution of
      three software components:

           +  pdc

           +  isl

           +  hpux.

After the processor is RESET, pdc, the processor-dependent code  (firmware), performs a self-test and initializes the processor.  It  then loads and transfers control to isl, the operating-systemindependent initial system loader.  isl, in turn, loads and transfers  control to the hpux utility, the HP-UX-specific bootstrap loader.   hpux then downloads the HP-UX kernel object file from an HP-UX file   system and transfers control to the loaded kernel image.

Common for both

1. The HPUX/HPUX.EFI program (also known as the secondary loader ) figures out what HP-UX kernel to load, and what arguments to pass to it (like init state).

2. The secondary loader relocates itself to the end of the initial memory module, loadsthe kernel at the beginning and starts running it. The kernel needs to fit into that area!

3. Kernel initialization (real mode):
initialize all of the memory, read /stand/ioconfig and /stand/rootconf files using the hpux loader’s system calls, initialize all modules (1st level I/O configuration), allocate equivalently-mapped data structures, PDIR and hash table, optimize assembly, craft process 0, go virtual.

4. Kernel initialization (virtual mode):
start the clock, start up the other processors, finish the I/O configuration (2nd level),initialize subsystems, intialize LVM/swap/dump, mount root file system read-only,fork() off system daemons.

5. fork() off /sbin/pre_init_rc and mount root file system read-write afterwards.

6. Start /etc/init process which, depending on the passed init state, starts working trough /etc/inittab or launches a shell in the case of a Single User or LVM Maintenance boot.
7. login console

Vpar Commands

ioscan

0/0 ba Local PCI Bus Adapter (782)
0/0/0/0 lan HP PCI 10/100Base-TX Core
0/0/1/0 ext_bus SCSI C895 Fast Wide LVD
0/0/1/0.7 target
0/0/1/0.7.0 ctl Initiator
0/0/2/0 ext_bus SCSI C875 Ultra Wide Single-Ended
0/0/2/0.6 target
0/0/2/0.6.0 disk SEAGATE ST39102LC
0/0/2/0.7 target
0/0/2/0.7.0 ctl Initiator
0/0/2/1 ext_bus SCSI C875 Ultra Wide Single-Ended
0/0/2/1.7 target
0/0/2/1.7.0 ctl Initiator
0/0/4/0 tty PCI Serial (103c1048)
0/0/5/0 tty PCI Serial (103c1048)

0/4 ba Local PCI Bus Adapter (782)
0/4/0/0 ba PCItoPCI Bridge
0/4/0/0/4/0 lan HP A5506A PCI 10/100Base-TX 4 Port
0/4/0/0/5/0 lan HP A5506A PCI 10/100Base-TX 4 Port
0/4/0/0/6/0 lan HP A5506A PCI 10/100Base-TX 4 Port
0/4/0/0/7/0 lan HP A5506A PCI 10/100Base-TX 4 Port

vparcreate

vparcreate -p vpar01  -a cpu::2 -a io:0/0 -a io:0/4 -a mem::1024 -a io:/0/0/2/0.6.0:boot -B auto

create vpar with 3 total cpu and  2 bound cpu at hardware path 41 and 45 and maximum of 4 cpus

vparcreate -p vpar01 -a cpu::3  -a cpu:::2:4 -a cpu:41 -a cpu:45  -a io:0/0 -a io:0/4 -a mem::1024
                                                                                                    -a io:/0/0/2/0.6.0:boot -B auto

Bound CPUs are attached to a vPar and cannot be removed while the vPar is up and running. IO interupts use the bound CPUs.

Booting monitor

vpar monitor is a file called /stand/vpmon. This file is loaded before hpux kernel is loaded. It will be loaded at ISL prompt.

Manually loading vpmon

Iterrupt boot at ISL prompt and then

ISL> hpux /stand/vpmon
MON>

boot/load commands available in vparmon prompt

MON> vparload  -all                         (boots all vpars )

MON> vparload -p vpar01                (boots vpar01)

MON> vparload -auto                       (boots all vpars, whose atuoboot flag set to AUTO)

MON> vparload -p vpar01 -o "is"         (boot vpar in single user mode )

MON > vparload -p vpar01 -b /stand/vmunix.prev ( boot alternate kernel)

MON > vparload -p vpar01 -B 0/3/0/0.2.0  (boot using disk device)

Boot vpar without entering vpmon prompt

ISL>hpux /stand/vpmon -p vpar01

Default partition database is /stand/vpdb


Booting  another vpar from running vpar


vpar01# vparboot -p vpar02

Modify  primary boot path

vpar01#vparmodify -p vpar01 -m io:0/4/0/0.0.5.0:BOOT

Modify alternate boot path

vpar01# vparmodofy -p vpar01 -m io:0/6/0/0.8.0:ALTBOOT

Delete a vpar

vpar01# vparremove -p vpar02

TOC a vpar

vpar01#vparreset -p vpar02 -t

shutdown/halt a  vpar 

vpar01#shutdown -h now

vpar01#vpararrest -p vpar02 -h

Status of vpar

vpar01# vparstatus


vpar01#vparstatus -v  -p vpar01


Saturday, January 28, 2012

Setup/Configure MC/SG Service Guard Cluster HP-UX

                           Given below is the steps to create a service guard cluster in HP-UX. We will use this cluster to run xclock application which will display servers clock to windows desktop. We need to use display managers like xmanager to view it.


On both nodes add host details

vi /etc/hosts
192.168.1.1 ux-memoirs01.ux-memoirs.com ux-memoirs01
192.168.1.2 ux-memoirs02.ux-memoirs.com ux-memoirs02
127.0.0.1 localhost loopback

Create shared VG 

Create Physical volume 

# pvcreate /dev/rdsk/c5t0d1
Creating "/etc/lvmtab_p".
Physical volume "/dev/rdsk/c5t0d1" has been successfully created.
# pvcreate /dev/rdsk/c5t0d2
Physical volume "/dev/rdsk/c5t0d2" has been successfully created. 

Check disk is in LVM 

# pvdisplay -l /dev/dsk/c5t0d1
/dev/dsk/c5t0d1:LVM_Disk=yes 

Create VG 

#mkdir /dev/vg01
#mknod /dev/vg01/group c 64 0x010000
# vgcreate /dev/vg01 /dev/dsk/c5t0d1
Increased the number of physical extents per physical volume to 2303.
Volume group "/dev/vg01" has been successfully created.
Volume Group configuration for /dev/vg01 has been saved in /etc/lvmconf/vg01.conf 

Configure  Alternate links 

# vgextend /dev/vg01 /dev/dsk/c11t0d1 /dev/dsk/c5t0d1 /dev/dsk/c7t0d1 /dev/dsk/c9t0d1 /dev/dsk/c19t0d1 /dev/dsk/c13t0d1 /dev/dsk/c15t0d1 /dev/dsk/c17t0d1
vgextend: The physical volume "/dev/dsk/c5t0d1" is already recorded in the "/etc/lvmtab" file.
Volume Group configuration for /dev/vg01 has been saved in /etc/lvmconf/vg01.conf 

# vgextend /dev/vg01 /dev/dsk/c11t0d2 /dev/dsk/c5t0d2 /dev/dsk/c7t0d2 /dev/dsk/c9t0d2 /dev/dsk/c19t0d2 /dev/dsk/c13t0d2 /dev/dsk/c15t0d2 /dev/dsk/c17t0d2
Current path "/dev/dsk/c11t0d1" is an alternate link, skip.
Current path "/dev/dsk/c7t0d1" is an alternate link, skip.
Current path "/dev/dsk/c9t0d1" is an alternate link, skip.
Current path "/dev/dsk/c19t0d1" is an alternate link, skip.
Current path "/dev/dsk/c13t0d1" is an alternate link, skip.
Current path "/dev/dsk/c15t0d1" is an alternate link, skip.
Current path "/dev/dsk/c17t0d1" is an alternate link, skip.
Volume group "/dev/vg01" has been successfully extended.
Volume Group configuration for /dev/vg01 has been saved in /etc/lvmconf/vg01.conf 

Create LV 

# lvcreate -L 100 -n mcsg /dev/vg01
Logical volume "/dev/vg01/mcsg" has been successfully created with
character device "/dev/vg01/rmcsg".
Logical volume "/dev/vg01/mcsg" has been successfully extended.
Volume Group configuration for /dev/vg01 has been saved in /etc/lvmconf/vg01.conf

Mirror LV 

# lvextend -m 1 /dev/vg01/mcsg
The newly allocated mirrors are now being synchronized. This operation will
take some time. Please wait ....
Logical volume "/dev/vg01/mcsg" has been successfully extended.
Volume Group configuration for /dev/vg01 has been saved in /etc/lvmconf/vg01.conf 

Create FS 

# newfs -F vxfs /dev/vg01/rmcsg
version 7 layout
102400 sectors, 102400 blocks of size 1024, log size 1024 blocks
largefiles supported 

Mount FS and verify 

# mount /dev/vg01/mcsg /mcsg 
then umount the  file system 

Export VG in Preview mode 

  you need to use -p (preview) and -s (scan) mode while doing this. If you are not using -p the vg  will be exported (deleted). when you are using -s the vg id will be added to map file, which will make import of vg in another node easier. Otherwise we need find disks which is same as in this host in the other host and then import
 
# vgexport -p -v -s -m /tmp/v01.map /dev/vg01
Beginning the export process on Volume Group "/dev/vg01".
vgexport: Volume group "/dev/vg01" is still active.
/dev/dsk/c5t0d1
/dev/dsk/c11t0d1
/dev/dsk/c7t0d1
/dev/dsk/c9t0d1
/dev/dsk/c19t0d1
/dev/dsk/c13t0d1
/dev/dsk/c15t0d1
/dev/dsk/c17t0d1
/dev/dsk/c11t0d2
/dev/dsk/c5t0d2
/dev/dsk/c7t0d2
/dev/dsk/c9t0d2
/dev/dsk/c19t0d2
/dev/dsk/c13t0d2
/dev/dsk/c15t0d2
/dev/dsk/c17t0d2
vgexport: Preview of vgexport on volume group "/dev/vg01" succeeded


 
Scp to other node 

# scp /tmp/v01.map 192.168.1.2:/tmp
The authenticity of host '192.168.1.2 (192.168.1.2)' can't be established.
RSA key fingerprint is 77:2a:6a:60:42:a9:ef:18:ba:7a:ce:a1:48:f0:a8:1a.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.1.2 ' (RSA) to the list of known hosts.
Password:
v01.map 100% 29 0.0KB/s 0.0KB/s 00:00 

Import the vg in second node 

# mkdir /dev/vg01
# mknod /dev/vg01/group c 64 0x010000 < This should be same on both nodes
# vgimport -v -s -m /tmp/v01.map /dev/vg01
Beginning the import process on Volume Group "/dev/vg01".
Logical volume "/dev/vg01/mcsg" has been successfully created
with lv number 1.
vgimport: Volume group "/dev/vg01" has been successfully created.
Warning: A backup of this volume group may not exist on this machine. 

*if you are using persistent device files then you need to add "-N" option also in vgimport

CLUSTER CONFIGURATION 

Disable automatic VG Activation 

Change AUTO_VG_ACTIVATE in /etc/lvmrc to 0
# grep AUTO_VG_ACTIVATE= /etc/lvmrc
AUTO_VG_ACTIVATE=0 

Set up trusted hosts within cluster systems 

vi /etc/cmcluster/cmclnodelist
ux-memoirs01 root
ux-memoirs02 root
Do the same in second node. 

Create cluster configuration file in /etc/cmcluster 

cmquerycl -v -C cmclconfig.ascii -n ux-memoirs01 -n ux-memoirs02
check_cdsf_group, no cdsf group specified.
Looking for other clusters ... Done
….. <o/p truncated >---
Writing cluster data to cmclconfig.ascii. 

Edit Cluster details 

CLUSTER_NAME
Time out parameters etc. 

Verify configuration file 

# cmcheckconf -v -C cmclconfig.ascii
Begin cluster verification...
Checking cluster file: cmclconfig.ascii
Checking nodes ... Done
…<o/p truncated >….
Creating the cluster configuration for cluster TEST_CLUSTER
Adding node ux-memoirs01 to cluster TEST_CLUSTER
Adding node ux-memoirs02 to cluster TEST_CLUSTER
cmcheckconf: Verification completed with no errors found.
Use the cmapplyconf command to apply the configuration 

Apply configuration in both nodes 

# cmapplyconf -v -C cmclconfig.ascii
Begin cluster verification...
Checking cluster file: cmclconfig.ascii
…<o/p cut >….
Marking/unmarking volume groups for use in the cluster
Completed the cluster creation 

Run the cluster 

# cmruncl -v
cmruncl: Validating network configuration...
Gathering network information
…<o/p truncated >….
Waiting for cluster to form .... done
Cluster successfully formed.
Check the syslog files on all nodes in the cluster to verify that no warnings occurred during startup. 

Verify cluster is running 

# cmviewcl
CLUSTER STATUS
TEST_CLUSTER up
NODE STATUS STATE
ux-memoirs01 up running
ux-memoirs02 up running 

Package configuration 

Create package configuration files 

# mkdir /etc/cmcluster/xclock
# cd /etc/cmcluster/xclock
# cmmakepkg -v -p xclock.pkg
The package template has been created.
This file must be edited before it can be used.
# cmmakepkg -v -s xclock.cntl
Done.
Package control script is created.
This file must be edited before it can be used. 

Edit Package configuration file 

*Highlighted in Bold are our values. Others default ( you may need to change them depending on your requirement).
 
PACKAGE_NAME XClock
PACKAGE_TYPE FAILOVER
NODE_NAME ux-memoirs01
NODE_NAME ux-memoirs02
# The default for "AUTO_RUN" is "YES", meaning that the package will be
# automatically started when the cluster is started, and that, in the
# event of a failure the package will be started on an adoptive node.
AUTO_RUN YES
RUN_SCRIPT /etc/cmcluster/xclock/xclock.cntl
HALT_SCRIPT /etc/cmcluster/xclock/xclock.cntl
RUN_SCRIPT_TIMEOUT NO_TIMEOUT
HALT_SCRIPT_TIMEOUT NO_TIMEOUT
NODE_FAIL_FAST_ENABLED NO
FAILOVER_POLICY CONFIGURED_NODE
FAILBACK_POLICY MANUAL
LOCAL_LAN_FAILOVER_ALLOWED YES
MONITORED_SUBNET 192.168.0.0 


Edit package control script 

VGCHANGE="vgchange -a e"
VG[0]="/dev/vg01"
LV[0]="/dev/vg01/mcsg"; FS[0]="/mcsg"; FS_MOUNT_OPT[0]=""; FS_UMOUNT_OPT[0]=""; FS_FSCK_OPT[0]=""
FS_TYPE[0]="vxfs"
IP[0]="192.168.10.91"
SUBNET[0]="192.168.0.0"
SERVICE_NAME[0]="xclock"
SERVICE_CMD[0]="/usr/bin/X11/xclock -display 16.191.121.3:0.0"  << ( ip of windows work      station where xmanager is running)
SERVICE_RESTART[0]="" 

you need to add the package ip in /etc/hosts in both nodes

192.168.10.91 xclock.ux-memoirs.com xclock

Verify configuration 

# cmcheckconf -v -P xclock.pkg
Begin package verification...
Checking existing configuration ... Done
….<o/p truncated >…
cmcheckconf: Verification completed with no errors found.
Use the cmapplyconf command to apply the configuration 

Add package to cluster 

# cmapplyconf -v -P xclock.pkg
Begin package verification...
Checking existing configuration ... Done
….<o/p truncated >…
Adding the package configuration for package XClock.
Modify the package configuration ([y]/n)? y
Completed the cluster update 

copy configuration files to other node 

# scp xclock* ux-memoirs02:/etc/cmcluster/xclock/
The authenticity of host 'ux-memoirs02 (16.118.112.92)' can't be established.
RSA key fingerprint is 77:2a:6a:60:42:a9:ef:18:ba:7a:ce:a1:48:f0:a8:1a.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'ux-memoirs02' (RSA) to the list of known hosts.
Password:
xclock.cntl 100% 73KB 73.4KB/s 73.4KB/s 00:00
xclock.pkg 100% 35KB 34.6KB/s 73.4KB/s 00:00 

Verify cluster status 

# cmviewcl
CLUSTER STATUS
TEST_CLUSTER up
NODE STATUS STATE
ux-memoirs01 up running
ux-memoirs02 up running
UNOWNED_PACKAGES
PACKAGE STATUS STATE AUTO_RUN NODE
XClock down halted disabled unowned 

Run the package 

# cmrunpkg XClock
Running package XClock on node ux-memoirs01
Successfully started package XClock on node ux-memoirs01
cmrunpkg: All specified packages are running 

verify cluster status 

# cmviewcl
CLUSTER STATUS
TEST_CLUSTER up
NODE STATUS STATE
ux-memoirs01 up running
PACKAGE STATUS STATE AUTO_RUN NODE
XClock up running disabled ux-memoirs01
NODE STATUS STATE
ux-memoirs02 up running 

Enable AUTO_RUN/Fail over 

# cmmodpkg -e XClock
cmmodpkg: Completed successfully on all packages specified 

Possible errors

# cmrunpkg XClock
Unable to run package XClock on node ux-memoirs01. Node is not eligible.
cmrunpkg: Unable to start some package or package instances. 

# cmviewcl -v -p XClock
UNOWNED_PACKAGES
PACKAGE STATUS STATE AUTO_RUN NODE
XClock        down      failed     enabled      unowned
Policy_Parameters:
POLICY_NAME CONFIGURED_VALUE
Failover configured_node
Failback manual
Script_Parameters:
ITEM STATUS NODE_NAME NAME
Subnet up ux-memoirs01 192.168.0.0
Subnet up ux-memoirs02 192.168.0.0
Node_Switching_Parameters:
NODE_TYPE STATUS SWITCHING NAME
Primary              up        disabled       ux-memoirs01
Alternate            up        disabled       ux-memoirs02
Other_Attributes:
ATTRIBUTE_NAME ATTRIBUTE_VALUE
Style legacy
Priority no_priority 

We are enabling per package wise which all are the nodes can run/receive package. 

# cmmodpkg -n ux-memoirs01 -n ux-memoirs02 -e XClock
cmmodpkg: Completed successfully on all packages specified
If AUTO_RUN is enabled above command will not work. Disable auto_run and run above command. Then enable auto_run

Once done it will be like this

Node_Switching_Parameters:
NODE_TYPE STATUS SWITCHING NAME
Primary              up           enabled      ux-memoirs01 (current)
Alternate            up           enabled       ux-memoirs02 

How package is starting
########### Node "ux-memoirs01": Starting package at Fri Jan 27 02:56:35 EST 2012 ###########
Jan 27 02:56:35 - Node "ux-memoirs01": Activating volume group /dev/vg01 with exclusive option.
Activated volume group in Exclusive Mode.
Volume group "/dev/vg01" has been successfully changed.
Jan 27 02:56:35 - Node "ux-memoirs01": Checking filesystems:
/dev/vg01/mcsg
/dev/vg01/rmcsg:file system is clean - log replay is not required
Jan 27 02:56:36 - Node "ux-memoirs01": Mounting /dev/vg01/mcsg at /mcsg
Jan 27 02:56:36 - Node "ux-memoirs01": Adding IP address 192.168.10.91 to subnet 192.168.0.0
Jan 27 02:56:36 - Node "ux-memoirs01": Starting service xclock using
"/usr/bin/X11/xclock -display 16.192.123.3:0.0"
########### Node "ux-memoirs01": Package start completed at Fri Jan 27 02:56:36 EST 2012 ########### 


Adding monitoring script  and custom start/stop scripts.

we are modifying the xclock to run/stop using  custom commands

Create monitoring script

# vi /etc/cmcluster/xclock/xclock.mon
#!/usr/bin/sh
LOG="/etc/cmcluster/xclock/xclock.cntl.log"
echo "Now entering the xclock package monitor \c" >> $LOG
echo "script on $(hostname) at $(date)." >> $LOG
while true
do
if ps -ef | grep -v grep | grep -q "/usr/bin/X11/xclock"
then
echo "Package xclock apparently ok \c"
echo "on $(hostname) at $(date)."
sleep 10
else
echo "Package xclock failed at $(date) \c"
echo "from node $(hostname)."
exit
fi
done >> $LOG
chmod 755 /etc/cmcluster/xclock/xclock.mon 

Modify control script 

SERVICE_CMD[0]="/etc/cmcluster/xclock/xclock.mon"
SERVICE_RESTART[0]=" -r 0" 

                  
Start up
function customer_defined_run_cmds
{
# ADD customer defined run commands.
/usr/bin/X11/xclock -update 1 -bg blue -display 16.192.123.3:0.0&
s test_return 51


Shut down
function customer_defined_halt_cmds
{
# ADD customer defined halt commands.
LOG="/etc/cmcluster/xclock/xclock.cntl.log"
echo "Now entering the customer_defined_halt_cmds \c" >> $LOG
echo "on $(hostname) at $(date)." >> $LOG
if ps -ef | grep -v grep | grep -q "/usr/bin/X11/xclock"
then
echo "Found the xclock process at $(date)." >> $LOG
echo "Killing xclock process at $(date)." >> $LOG
kill -9 $(ps -ef | grep -v grep | grep "/usr/bin/X11/xclock"| cut -c10-14)
else
echo "Note: In customer_defined_halt_cmds \c. >> $LOG
echo .on $(hostname), and could not find the \c" >> $LOG
echo "xclock process at $(date)." >> $LOG
fi
test_return 52

copy control script and monitoring script to other node 

# scp xclock.cntl xclock.mon ux-memoirs02:/etc/cmcluster/xclock/
Password:
xclock.cntl 100% 74KB 74.1KB/s 74.1KB/s 00:00
xclock.mon

Then start package as usual.