Category Archives: HPUX

How to identify current boot disk in HPUX

When root disk is mirrored at OS level, its difficult to know which disk system is booted from. Learn here how to identify current boot disk in HPUX. 

There are a couple of ways by which you can identify boot disk from which the HPUX system is currently booted. This information is handy when HPUX is having root mirroring and if any maintenance activity needs to be carried out.

In such scenarios, one must know the current boot disk out of 2 root mirror disks. For example, if you have a root disk failure in the mirror then you must know if boot disk is damaged or not so that you can safely redirect IO to another disk/plan your maintenance.

Method 1

An easy method is to use setboot command which clearly states the primary boot disk.

# /usr/sbin/setboot -v
Primary bootpath : 2/0/0/3/0.0x6.0x0 (/dev/rdisk/disk40)
HA Alternate bootpath :
Alternate bootpath : 2/0/0/2/0.0x6.0x0 (/dev/rdisk/disk16)
 
Autoboot is ON (enabled)
Hyperthreading : OFF
: OFF (next boot)
 
----- output truncated -----

Method 2

This is a bit tricky. You need to use adb to get the hardware address of the booted disk. Then this hardware address can be traced back to disk name by matching in under ioscan output.

# echo "boot_string/S" | adb /stand/vmunix /dev/kmem
boot_string:
boot_string: (12/0/9/1/0.0.0;)/stand/vmunix

Method 3

Even by observing Syslog messages after boot, one can determine from which disk kernel was booted.

# grep "Boot device" /var/adm/syslog/syslog.log
Nov 15 18:44:18 myserver1 vmunix: Boot device's HP-UX HW path is: 2/0/0/3/0.0x6.0x0
.0

In the above output, it clearly mentions the hardware path of the disk from which the kernel was booted. Now, this hardware path can be matched with the device name in ioscan -fnCdisk output and a disk name can be obtained.

HP blade firmware upgrade process HPUX

Step by step procedure to upgrade HP blade firmware running HPUX operating system. Use this process with caution and on your own risk since mistakes may lead to an unstable system.

This post will cover step by step procedure to upgrade HP blade firmware running HPUX OS.

Warning: Halting the upgrade process in between can send your hardware in an unusable state. This activity needs experts/vendor support to be carried out. Proceed with caution and at your own risk.

Step 1

Login to MP and get current firmware version using sysrev command from the command menu. Download the new firmware from the HP website (for example BL860c firmware here). You should be having a valid contract with the vendor. This should be a tar file that you can un-tar on the HPUX server. Download and transfer files to the HPUX server. Extract the content of the tar file. There should be a list of files listed below.

hpoa330.bin
PF_CTAHISYS0425EFI.tar
bl860c_1_92_install_manual.txt
fweupdate_1p92.efi
update_SFW.nsh

Step 2

Get your boot disk path (primary boot path) using setboot command.

# /usr/sbin/setboot -v
Primary bootpath : 2/0/0/3/0.0x6.0x0 (/dev/rdisk/disk40)
HA Alternate bootpath :
Alternate bootpath : 2/0/0/2/0.0x6.0x0 (/dev/rdisk/disk16)

Autoboot is ON (enabled)
Hyperthreading : OFF
: OFF (next boot)

----- output truncated -----

Step 3

Now you need to copy firmware files in EFI partition of this primary boot disk. EFI partition is slice/partition 1 of the disk. Follow the below commands to create the directory first and then copy files within it.

# /usr/sbin/efi_mkdir -d /dev/rdsk/c2t1d0s1 /efi/hp/firmware
# /usr/sbin/efi_cp -d /dev/rdisk/disk1_p1 update_SFW.nsh /efi/hp/firmware/update_SFW.nsh
# /usr/sbin/efi_cp -d /dev/rdisk/disk1_p1 fweupdate_1p92.efi /efi/hp/firmware/fweupdate_1p92.efi

List the content of the directory to check if they are copied properly or not.

# /usr/sbin/efi_ls -d /dev/rdisk/disk1_p1 /efi/hp/firmware

Step 4

Once you are done with copying firmware in EFI partition, reboot the system. Halt at EFI shell. At EFI shell, enter into the primary boot disk. You should see a prompt like fs0. Now navigate to the directory we created in the above steps and then run .nsh file to start the upgrade process.

fs0:
cd EFI/HP/FIRMWARE
dir
fs0:\EFI\hp\firmware> dir
Directory of: fs0:\EFI\hp\firmware
05/20/11 02:03a <DIR> 4,096 .
05/20/11 02:03a <DIR> 4,096 ..
05/22/11 08:58p 10,168,320 fweupdate_1p92.efi
05/22/11 08:58p 26 update_SFW.nsh
2 File(s) 10,168,346 bytes
2 Dir(s)
fs0:\EFI\hp\firmware> update_SFW.nsh
update_SFW.nsh> fweupdate_1p92.efi -mnuF
*************************************************************************
****                                                                 ****
****                            FWEUPDATE                            ****
****            EFI Firmware Update Utility for IPF Systems          ****
****         (c) Copyright Hewlett-Packard Company, 2001-2006        ****
****                      All rights reserved.                       ****
****                                                                 ****
****                              v1.00                              ****
****                                                                 ****
*************************************************************************
Executing Command line options: -mnuF......................................... 


----- output truncated -----

Once you see above upgrade process started on console do not disturb system in any way. Halting this process in between may make your system unstable.

Step 5

After the upgrade process completes, MP will be reset and you will lose connection to MP. Start a new session and connect to MP. Go to command menu and verify updated firmware version using sysrev command under the command menu!

Adding extra or secondary swap in HPUX

Learn how to add a secondary swap or extra swap in running the HPUX system without any downtime. It uses free space in root VG to mount as swap.

When the system runs low on memory and swap continuously, its time to troubleshoot. Even after troubleshooting and all available app/OS tuning you are still running out of memory then you can try adding extra swap before you think of adding RAM to the server which involves cost/resources of parent machine.

Step 1

For adding extra swap check how much space you have available in root volume group vg00. Use vgdisplay command to get free PE and PE size numbers.

# /usr/sbin/vgdisplay vg00
--- Volume groups ---
VG Name                     /dev/vg00
VG Write Access             read/write
VG Status                   available
Max LV                      255
Cur LV                      9
Open LV                     9
Max PV                      16
Cur PV                      2
Act PV                      2
Max PE per PV               4384
VGDA                        4
PE Size (Mbytes)            16
Total PE                    6544
Alloc PE                    5978
Free PE                     566
Total PVG                   0
Total Spare PVs             0
Total Spare PVs in use      0

Here we have 566 free PE with 16MB size of each. This sums up to 8.8GB of free space in root VG. We can use space from this 8.8GB for adding extra swap.

Read our Linux swap related articles :

Check the current swap configuration. Here you can see like default HPUX configuration, lvol2 is mounted as swap.

# /usr/sbin/swapinfo -tam
             Mb      Mb      Mb   PCT  START/      Mb
TYPE      AVAIL    USED    FREE  USED   LIMIT RESERVE  PRI  NAME
dev       43008       0   43008    0%       0       -    1  /dev/vg00/lvol2
reserve       -    1963   -1963
memory    40861    9261   31600   23%
total     83869   11224   72645   13%       -       0    -

Step 2

Create a new contiguous logical volume with no bad block relocation policy and size of your requirement. Let’s make an LV of 2GB.

# lvcreate -L 2048 -C y -r n /dev/vg00
Logical volume "/dev/vg00/lvol10" has been successfully created with character device "/dev/vg00/rlvol10"
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf

Step 3

Start swap on this lvol. Add -f argument to start forcefully if the below command fails.

# swapon -p 1 /dev/vg00/lvol10

Step 4

Edit /etc/fstab to mount this LV as swap on every boot. Add below entry :

/dev/vg00/lvol10 ... swap pri=1 0 1

Step 5

Check again swap size. Now you can see new lvol is added in the swap.

# /usr/sbin/swapinfo -tam
             Mb      Mb      Mb   PCT  START/      Mb
TYPE      AVAIL    USED    FREE  USED   LIMIT RESERVE  PRI  NAME
dev       43008       0   43008    0%       0       -    1  /dev/vg00/lvol2
dev        2048       0    2048    0%       0       -    2  /dev/vg00/lvol10    
reserve       -    1963   -1963
memory    40861    9261   31600   23%
total     85917   11224   74693   13%       -       0    -

Adding new storage LUN to integrity virtual machine (iVM) in HPUX

Step by step procedure to add storage LUNs to integrity virtual machine on HPUX host. Further, learn to use those LUNs in LVM of the guest servers.

Steps to add new LUN into integrity virtual machine (iVM) in HPUX and use it within existing VG or create a new VG on it. In this process, storage luns are always presented to the physical host server. from host, they are attached to the virtual guest server running on it.

Step 1

Identify new LUN on the HP iVM host server. When new LUN is presented to iVM, run ioscan command to scan new disks. Post ioscan, run insf command to make sure all available hardware has its related files created in the kernel.

# ioscan -fnCdisk
# insf -e

Now your new LUN is identified in the kernel. Match lun id in storage utility (syminq in case of EMC storage, evainfo in case of HP EVA storage etc) and get related disk number. We are using agile naming convention here so lets take /dev/rdisk/disk10/dev/rdisk/disk11 are new identified disks.

Step 2

Make disks LVM ready by using pvcreate.

# pvcreate /dev/rdisk/disk10
Physical volume "/dev/rdisk/disk10" has been successfully created.

# pvcreate /dev/rdisk/disk11
Physical volume "/dev/rdisk/disk11" has been successfully created.

Step 3

Attach these disks to iVM (guest) which is running on the host. Assume vmserver1 is our iVM here.

# hpvmmodify -P vmserver1 -a disk:avio_stor::disk:/dev/rdisk/disk10
# hpvmmodify -P vmserver1 -a disk:avio_stor::disk:/dev/rdisk/disk11

Step 4

Once the above commands are successful, disks are attached to iVM and need to scan in the guest. Login to iVM server and scan the new disks the same way we did in steps 1 and 2 on the host. Let’s say those disks are identified as /dev/rdisk/disk2/dev/rdisk/disk3 on the guest server. Observe those are identified as Virtual disk on VM.

disk 6 0/0/0/0.2.0 sdisk CLAIMED DEVICE HP Virtual Disk
/dev/dsk/c0t2d0 /dev/rdsk/c0t2d0

disk 8 0/0/0/0.3.0 sdisk CLAIMED DEVICE HP Virtual Disk
/dev/dsk/c0t3d0 /dev/rdsk/c0t3d0

Step 5

Complete LVM tasks on these disks to use space in the mount point.
To create a new VG named vg01

# mkdir /dev/vg01
# mknod /dev/vg01/group c 64 0x010000
# vgcreate -s 64 -p 60 -e 12500 vg01 /dev/disk/disk2 /dev/disk/disk3
Volume group "/dev/vg01" has been successfully created.
Volume Group configuration for /dev/vg01 has been saved in /etc/lvmconf/vg01.conf
# lvcreate -L 200 /dev/vg01
Logical volume "/dev/vg01/lvol1" has been successfully created with
character device "/dev/vg01/rlvol1".
# newfs -F vxfs -o largefiles /dev/vg01/rlvol1
 version 7 layout
 204800 sectors, 204800 blocks of size 1024, log size 1024 blocks
 largefiles supported
# mkdir /data
# mount /dev/vg01/lvol1 /data

To extend current existing VG named vg02 & mount point /data1 within it

# vgextend vg02 /dev/disk/disk2 /dev/disk/disk3
Volume group "vg02" has been successfully extended.
Volume Group configuration for /dev/vg02 has been saved in /etc/lvmconf/vg02.conf
# lvextend -L 512 /dev/vg02/lvol1
Logical volume "/dev/vg02/lvol1" has been successfully extended.
Volume Group configuration for /dev/vg02 has been saved in /etc/lvmconf/vg02.conf
# fsadm -F vxfs -b 524288 /data1
vxfs fsadm: V-3-23585: /dev/vg02/rlvol1 is currently 7731200 sectors - size will be increased

HPUX Patch naming conventions

HP releases the HPUX patch twice a year. Few break-fix patches releases as on need basis. Here are naming conventions being followed by HP.

HP releases OS patches for HPUX every 6 months i.e. twice a year. For smaller HPUX patch which are releases as on need basis, HP follows below naming conventions

Patch name format is PHxx_yyyy

Where,

xx = area of patch
CO: General HPUX commands
KL: Kernel patches
NE: Network-specific patch
SS: all other subsystem patches

yyyy = unique number

From patch name, you will be able to guess area of its impact so that you can plan your activities accordingly. If the patch requires a reboot or not can be determined while downloading the patch from the HP portal itself or even by running swinstall command with -p (preview) argument.

HP patches are available on http://software.hp.com/ which will redirect you to HP software depot home. HP passport login required to download patches or software from software depots.

Basics of LVM legends

Get acquainted with LVM (Logical Volume Manager) terms. Learn what is physical volume, logical volume, physical extent, volume group, and logical extent.

LVM (logical volume manager) legends

PV is a Physical Volume

Any single disk / LUN on the system is identified as PV. It can be raw or formatted with a file system. Raw PV is referred to as /dev/rdsk/c0t0d1 (legacy) or /dev/rdisk/disk1 (agile) whereas formatted one is referred to as  /dev/dsk/c0t0d1 (legacy) or /dev/disk/disk1 (agile). Check PV name in below output as a formatted device.

# vgdisplay -v vg00

--- Volume groups ---
VG Name                     /dev/vg00
VG Write Access             read/write
VG Status                   available
Max LV                      255
Cur LV                      13
Open LV                     13
Max PV                      16
Cur PV                      1
Act PV                      1
Max PE per PV               4355
VGDA                        2
PE Size (Mbytes)            32
Total PE                    4345
Alloc PE                    4303
Free PE                     42
Total PVG                   0
Total Spare PVs             0
Total Spare PVs in use      0

   --- Logical volumes ---
   LV Name                     /dev/vg00/lvol1
   LV Status                   available/syncd
   LV Size (Mbytes)            1024
   Current LE                  32
   Allocated PE                32
   Used PV                     1

   --- Physical volumes ---
   PV Name                     /dev/dsk/c3t0d0s2
   PV Status                   available
   Total PE                    4345
   Free PE                     42
   Autoswitch                  On
   Proactive Polling           On
Physical volume naming conventions :

/dev/rdsk/cxtxdx – Legacy character device file
/dev/rdsk/cxtxdxs2 – Legacy character device file, partition 2
/dev/dsk/cxtxdx – The legacy block device file
/dev/dsk/cxtxdxs2 – Legacy block device file, partition 2
/dev/rdisk/diskx – The persistent character device file
/dev/rdisk/diskx_p2 – Persistent character device file, partition 2
/dev/disk/diskx – The persistent block device file
/dev/disk/diskx_p2 – Persistent block device file, partition 2

PE is Physical Extent

Its smallest chunk of PV can be used as a block under the file system. PV is consists of the number of PEs. We always use PV names while using LVM commands. In the above example, PE size is set to 32MB & a total of 4345 PEs are available on disk.

Read our LVM tutorials: LVM cheat sheet.

VG is Volume Group

One or more PV come together to form a Volume Group. This grouping enables to slice down combined
storage capacity of disks to our choice of small volumes. In the above example, vg00 is volume group made up of single PV & it’s sliced down to 8 LV (only one shown in above example)

LV is the Logical Volume

Its a slice of volume group using some capacity of PV to form a smaller volume. Its basically used as a mount point /swap like drives (C:, D:) in Windows. We can see one LV in above example and its details.
LE is Logical Extent.
Same as PE, LE is the smallest chunk of LV.

Below tables gives you an idea about some numbers related to them:

LVs per VG range: 1-255, default: 255
PVs per VG range: 1-255, default: 16
PEs per VG   range : 1-66535 default : 1016

with the above table, as max PE size is 64MB and 66,535 PEs max per VG, one can create a max of 64×66353=4TB of the file system.

Password file commands

Ever wondered which all special commands can be executed on /etc/passwd file? Learn here the list of special commands and their uses for the password file.

Here is the list of commands which can be used on /etc/passwd file.

vipw

This command is being used to edit /etc/passwd file manually. It is not recommended to edit /etc/passwd file manually. All changes on user accounts should be carried out using commands like usermod. But in some scenarios, if you want to edit the password file manually, then use this command. It opens the file in vi editors and locks it for other users. So any other admin from any other terminal won’t be able to open the file in the editor for manual editing. This ensures the integrity of the file.

Also read: Understanding /etc/passwd file.

pwck 

To check the integrity of /etc/passwd file this command can be used. Once executed it checks passwd files and its all fields. It reports any issues observed in the file e.g. if the user directory does not exist on the server, it will report it.

# /usr/sbin/pwck

[/etc/passwd] sfmdb:*:107:20::/home/sfmdb:/sbin/sh
        Login directory not found

[/etc/passwd] smmsp:*:109:20::/home/smmsp:/sbin/sh
        Login directory not found

pwconv

It generates /etc/shadow file which has user passwords in the encrypted format under the second field in each user entry. If /etc/shadow file already exists on the system then this command will update relevant fields if there were any changes in /etc/passwd file. If your system is trusted (see tsconvert command) then the user password database (Trusted Computing Database) is being maintained separately and /etc/shadow doesn’t exist on the system. In that case, this command will update the TCB accordingly.

# /usr/sbin/pwconv
Updating the tcb to match /etc/passwd, if needed.

pwunconv

It reverses the changes made by pwconv command.

HPUX boot process

HPUX boot process explained. Learn which all processes happened in the background while HPUX server boots.

It’s not a fully detailed boot process. It’s a very short form of things happens during boot. To make it understand and remember (for interviews) easily!

1) PDC (processor dependent code) gets executed

  • Checks CPU
  • Checks stable storage for the boot path
  • Loads ISL utilities from leaf area of the boot disk
  • Here you can halt boot using ESC key and can run PO, SEA commands.

2) ISL (Initial system loader) gets loaded

  • Read AUTO file default kernel
  • Load and runs HPUX from LIF area
  • Here you can halt the boot process and boot system into single-user mode. You can provide diff options to SSL i.e. kernel vmunix. Like,hpux –ishpux –lq, hpux –lm

3) HPUX loads (Secondary system loader)

  • Uses options and path names from ISL to load the kernel
  • And by default loads vmunix

4) After kernel vmunix gets loaded –

  • Swapper daemon starts with PID 0
  • Kernel runs /sbin/pre_init_rc
  • Kernel calls /sbin/init
  • /sbin/init reads /etc/inittab and calls –
  1. /sbin/ioinit – to scan hardware and build kernel io tree
  2. /sbin/bcheckrc – to check FS listed in /etc/fstab
  3. /sbin/rc – to start additional services like lp, cron, cde
  4. /usr/sbin/getty – to start n show login prompt to the user.

Please note that this is not the exact hpux boot process. There are alterations depends on the system being referred to is PA-RISC or Itanium. This article gives a fair idea of what’s happening in the background when HPUX boot happens.