Friday, September 7, 2012

share: Running old NFS library, requires new NFS library


     Today after editing the /etc/dfs/dfstab file, when I run "shareall -F nfs" in one of the server I got  below  error

"share: Running old NFS library, requires new NFS library".

Finally Issue turned out to be I am running  shareall command from  hpux 11.31 in   hpux 11.23  :(

HPUX - 11.23
$ /usr/sbin/swlist -l product | grep -i nfs
  NFS                           B.11.23        ONC/NFS; Network-File System,Information Services,Utilities

HPUX- 11.31
$/usr/sbin/swlist -l product | grep -i nfs
 NFS                           B.11.31.07.01  ONC/NFS; Network-File System,Information Services,Utilities

Solution

you need to edit /etc/exports to add share details. then run "exportfs -av" to export the shared file system.


Sunday, August 19, 2012

HP-UX cmmodnet: Network interface lan3 has already been in this state



Issue:-

Even though lan3 is running perfectly fine MCSG thinks it as down and fail over to standby lan. We will not be able to  fail back  to lan3 (primary lan)


# cmmodnet -e lan3

cmmodnet: Network interface lan2 has already been in this state.



cmviewcl output for this host.



# cmviewcl -v -n unixmemoirs-01



  NODE                STATUS       STATE

  unixmemoirs-01        up           running



    Network_Parameters:

    INTERFACE    STATUS                     PATH                NAME

    PRIMARY      down (Link and IP)         0/0/0/4/0/0/0       lan3

    PRIMARY      up                         0/0/0/3/0/0/0       lan2

    PRIMARY      up                         0/0/0/3/0/0/1       lan1



Syslog output.


Aug 19 17:06:22 unixmemoirs-01 syslog: cmmodnet -e lan3

Aug 19 17:06:22 unixmemoirs-01 cmnetd[21252]: Request to enable interface lan3

Aug 19 17:06:22 unixmemoirs-01 cmnetd[21252]: Attempt to enable network interface lan3 when it is already enabled.

 

Trouble shooting done :-

Verified interface status in lanadmin

Administration Status (value)   = up(1)
Operation Status (value)        = up(1)

Verified ifconfig status

# ifconfig la3
lan2: flags=2000000000001843<UP,BROADCAST,RUNNING,MULTICAST,CKO,TSO>



verified  link connectivity from  another interface in the same server

# linkloop -i 6 0x64315001e1d8

Link connectivity to LAN station: 0x64315000e1d8

-- OK

Verified link connectivity to another server

# linkloop -i3 0x68B599923388

Link connectivity to LAN station: 0x68B599924988

-- OK

#


Everything is fine. So what will be the issue. After long trouble shooting found out the issue. Outbound packet count not increasing.


Outbound Unicast Packets        = 250741234


Since the outbound packet count is not increasing cmcld thinks as link layer is down and marks lan3 as down and failover to standby lan.

Solution:

Reset lan3.

#lanadmin -r 3






 

Wednesday, August 15, 2012

HP-UX Printer prints multiple copies and prints coming out too slow



Newer printer scripts are having True End-of-Job  and Job Recovery  options as below

  Options:                          Current Settings:
  --------                          -----------------
  1) Default Queue                      [NO]
  2) Status Log                         [OFF]
  3) Network Address                    [PRINTER01]
  4) Additional printer changes . . .

  Modelscript used for this queue is net_ljM603

Select an item for change, or '0' to make the changes effective (q - quit): 4

        Modifiable Printer Parameters
        -----------------------------
        Settings may be changed by selecting the corresponding numbers.  You
        can make as many changes as you want until 'q' is selected.


    Options:                          Current Settings:
    --------                          -----------------
   1) Job Recovery                         [ON]
   2) True End-of-Job                      [ON]
   3) Banner Page                          [OFF]
   4) Default Printing Language            [AUTO]
   5) PostScript Level                     [Level 3]
   6) Banner Tray                          [2]
   7) Banner Paper Size                    [default]
   8) Duplex print                         [default]





If these options are turned on like above we will get multiple copies while printing and print jobs will get delayed. So we need to turn them off like below


  1) Job Recovery                         [OFF]
  2) True End-of-Job                      [OFF]

True-end-of-job means that the handshaking with the printer will not terminate until the last page of the job hits the output tray.  This is why printing get delayed

Job Recovery is a way to restart a job when it gets interrupted (network interrupts etc).  This is why you are getting multiple copies.

Tuesday, August 14, 2012

Dot space Dot Slash and sudo

              Today have a request to provide  sudo permission to an application script and another script which loads its environment variables 

But  I am not able to execute the script even though I have given permission in sudoers.

The steps to execute the script.

1) .  /opt/custom/etc/setup_env.sh (here is a space between dot and slash) or cd  /opt/custom/etc/  then . ./setup_env.sh (there is a space between dot and dot )
      
2) .  /opt/custom/bin/start_server serv1

The issues

    Setting environment variables  will not work as expected. lets see what happens when we execute it.


 why there is a space required between dot and slash or dot and dot.

    if we execute the  /opt/custom/etc/setup_env.sh directly it will set the environment variables for the script itself  (sub shell its running ) and exists. There will not be any variables set for the shell where we are executing the script.

But if we execute the  script  like this ".  /opt/custom/etc/setup_env.sh" it will set the environment variable for this current shell also.  That's why there is a space required.

2. If we execute  "sudo .  /opt/custom/etc/setup_env.sh"  sudo will complain command not found. Its because "." (dot) means current directory and there it search for the command and obviously it will not find it.

How to overcome this.

1. Append the application  environment variable paths in root's profile. Provide permission to required commands in sudoers

OR

2. Create a script like this if there are only some commands need to be executed. Then add  the  script in sudoers for that particular user.

cat /opt/custom/bin/start.sh
#!/usr/bin/sh
echo "Please give the name of the instance to start: \c"
read INSTANCE
. /opt/custom/etc/setup_env.sh  #dot space :)
/opt/custom/bin/start_server $INSTANCE

OR

3. Update to latest sudo , which will have the option sudo -E , so that it will preserve the environment of executing user ( provided the executing user have application environment set in  his path )

The -E (preserve environment) option indicates to the security policy that the user wishes to preserve their existing environment variables. The security policy may return an error if the -E option is specified and the user does not have permission to preserve the environment



    

Tuesday, June 26, 2012

Mount ISO files in Linux,Solaris,HP-Ux Servers

LINUX SERVERS
-----------------------------
1. Run the following command to create an empty directory
   where the ISO file can be mounted:
    mkdir /isoimg
2. Run the following command to mount the ISO file on the
   mount point:
    mount -o loop /tmp/<ISO_file> /isoimg
3. Run the following command to unmount the ISO file:
    umount /isoimg

SOLARIS SERVERS
-----------------------------
1. Run the following command to create an empty directory
   where the ISO file can be mounted:
    mkdir /isoimg
2. Run the following command to create a pseudo device:
    lofiadm -a /tmp/<ISO_file> /dev/lofi/1
3. Run the following command to mount the pseudo device
   on the mount point:
    mount -F hsfs -o ro /dev/lofi/1 /isoimg
4. Run the following command to unmount the ISO file:
    umount /isoimg

HP-UX 11.11 and HP-UX 11.23 SERVERS
-----------------------------
1. Run the following command to create an empty directory
   where the ISO file can be mounted:
    mkdir /isoimg
2. Run the following command to start the pfs mount daemon
    nohup pfs_mountd &
3. Run the following command to start the pfs daemon
    nohup pfsd &
4. Run the following command to mount the iso image
   using following command
    pfs_mount -o xlat=UNIX /tmp/<ISO_file> /isoimg
5. Run the following command to unmount the ISO file:
    umount /isoimg

HP-UX 11.31 SERVERS
-----------------------------
1. Install the ISOIMAGE-ENH enhancement bundle
(also dependant patches PHCO_39672, PHCO_39673,
  PHCO_39674, and PHCO_39675)
2.Run the following command to create an empty directory
  where the ISO file can be mounted:
   mkdir /isoimg
3. Run the following command to mount the ISO File:
   mount F cdfs /tmp/<ISO_file> /isoimg
   If the mount command generates an invalid operand
   error, try the following command to load the correct
   kernel module:
   kcmodule fspd=loaded
(If prompted, proceed with the automatic
  backup configuration.)
  Finally, try the mount command again.
5. Run the following command to unmount the ISO File:
    umount /isoimg

Wednesday, June 6, 2012

File system not mounting during system boot Unix

       I had a strange problem when I added a new file system to one of my Linux box. The file system is not mounting. But it turned out to be a funny mistake :)

I have added the file system like this in /etc/fstab

/dev/vg00/lvol03        /usr                   ext3    defaults        1 2
/dev/vg00/lvol04        /usr/src             ext3    defaults        1 2
/dev/vg00/lvol07      /var/crash        ext3    defaults     1 2
/dev/vg00/lvol02        /var                   ext3    defaults       1 2

See the file system in bold. You guess it  correctly !!

Before mounting the /var file system, os is trying to mount  /var/crash, simply it  fails :)

Change the fstab entry like this it will work..








/dev/vg00/lvol03        /usr                   ext3    defaults        1 2
/dev/vg00/lvol04        /usr/src             ext3    defaults        1 2
/dev/vg00/lvol02        /var                   ext3    defaults       1 2
/dev/vg00/lvol07      /var/crash        ext3    defaults     1 2



Monday, June 4, 2012

Useful scsimgr commands hp-ux 11.31

To get LUN  ID of a device

# scsimgr get_attr -H 3/0/10/1/0/4/0.0x50001fe1501ef98f.0x400a000000000000 -a lunid

        SCSI ATTRIBUTES FOR LUN PATH : 3/0/10/1/0/4/0.0x50001fe1501ef98f.0x400a000000000000

name = lunid
current =0x400a000000000000 (LUN # 10, Flat Space Addressing)
default =
saved =

To get www id and serial no of a device

scsimgr get_attr -D /dev/rdisk/disk535 -a wwid -a serial_number

        SCSI ATTRIBUTES FOR LUN : /dev/rdisk/disk535

name = wwid
current = 0x600508b4000cefeb0000600002150000
default =
saved =

name = serial_number
current = "PAFURB49SXC01Y"
default =
saved =

To get www id and serial no of a device in single line


# scsimgr -p get_attr -D /dev/rdisk/disk535 -a wwid -a serial_number
0x600508b4000cefeb0000600002150000:"PAFURB49SXC01Y"


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.