setboot returns the Primary and Alternate (and HA Alternate) boot paths but starting with 11.31, a mix of agile names and legacy names may be found in the bootconf file, lvlnboot and other system tools. To script the handling of DSFs (Device Special Files) across multiple OS versions, special steps are needed to identify the device files for 11.31 versus 11.23 and earlier.
From setboot, the hardware path can be extracted as field #4:
PRIPATH=”$(setboot |
awk ‘/Primary bootpath/{print $4}’)”
The bootpath can be translated into a standard CTD name with ioscan:
PRICTD=”$(ioscan -knfH $PRIPATH |
tail -1 | awk ‘{print $1}’)”
This works for all versions of HP-UX starting with 10.01 through 11.23. However, for 11.31, special handling is required. setboot returns a LUN hardware path like this:
# setboot
Primary bootpath :
0/1/1/0.0x5000c50007153089.0x0
(/dev/rdisk/disk5)
So setboot returns the agile name (disk5) and now we must translate this into the CTD name. To extract the device file, use:
PRIPATH=”$(setboot 2>/dev/null |
awk ‘/Primary bootpath/{print $5}’|tr -d “()”)”
The device file is enclosed in () so using tr -d “()”, these characters can be removed. Then ioscan helps by providing the DSF names in a table format:
# ioscan -m dsf /dev/rdisk/disk5
Persistent DSF Legacy DSF(s)
========================================
/dev/rdisk/disk5 /dev/rdsk/c0t0d0
The CTD name is always the right-hand field, so extract the last field of the last line:
PRICTD=”$(ioscan -m dsf /dev/rdisk/disk5 |
tail -1 | awk ‘{print $NF}’)”
For pre-11.31 systems, just extract the bootpath from setboot and use ioscan to find the device file:
PRIPATH=”$(setboot 2>/dev/null |
awk ‘/Primary bootpath/{print $NF}’)”
PRICTD=”$(ioscan -knfH $PRIPATH |
tail -1 | awk ‘{print $1}’)”
Now the primary CTD DSF ($PRICTD) will be set for all versions of HP-UX.
– See more at: http://serviceitdirect.com/blog/setboot-path-and-dsf#sthash.ifk8CIXJ.dpuf
Tags: HP-UX