cancel
Showing results for 
Search instead for 
Did you mean: 

Boot disk

SOLVED
Go to solution
arunthoray
Occasional Advisor

Boot disk

How to find out the device file of boot disk from which os got booted in a mirrored root disk environment ?

6 REPLIES
Bill Hassell
Honored Contributor
Solution

Re: Boot disk

No simple answer...it is very different depending on the revision of HP-UX you are using and whether you are running on PARISC or Itanium.  Here is a code snippet that runs on all versions of 10.xx through 11.31, PARISC and Itanium (aka, Integrity):

 

#!/usr/bin/sh

set -u

MYREV=$(uname -r | cut -f2-3 -d. | tr -d .)
echo "   Last booted using \c"

# boot string not available for 11.23 and higher  -- returns device minor number only
# ie, 0x1f010000 (PARISC) or 0x3000003 (IA)
# For 11.31, it will be the minor # for DSF device -- use ioscan to find CTD

if [[ $MYREV -gt 1111 ]]        ## new adb for 11.2x and higher
then
    BOOTCODE=$(echo "bootdev/x" \
      | adb -n /stand/vmunix /dev/kmem \
      | tail -1 \
      | tr -d " ")
    BOOTSTRING=$(echo $BOOTCODE | cut -dx -f2)
    LEN=${#BOOTSTRING}
    BOOTMINOR=$(echo "$BOOTSTRING" | cut -c $(($LEN-5))-)
    DISKDEVS=$(ll /dev/dsk | grep "0x$BOOTMINOR" | awk '{print $NF}')

# for 11.31, minor is for the DSF device file

    if [ $MYREV -ge 1131 ]
    then
       DISKDEVS=$(ll /dev/disk | grep "0x$BOOTMINOR" | head -1 | awk '{print $NF}' | cut -f1 -d_)
       DISKCTD=$(ioscan -m dsf /dev/disk/$DISKDEVS | tail -1 | awk '{print $NF}')
       DISKDEVS="$DISKDEVS or $(ioscan -m dsf /dev/disk/$DISKDEVS \
         | tail -1 \
         | awk '{print $NF}' \
         | awk -F / '{print $NF}' )"
    fi

    echo "$BOOTCODE ($DISKDEVS)"

else                            # tabs supplied by adb
   echo "boot_string/S"  \
      | adb -k /stand/vmunix /dev/kmem   \
      | tail -1 \
      | tr -d '[:blank:]' \
      | cut -d: -f2-            # drop "boot_string:"
fi

 You can strip out the code that matches your version of HP-UX or use all of it to handle all possible versions of HP-UX starting with 10.xx

 

 



Bill Hassell, sysadmin
VKV
Advisor

Re: Boot disk

Thank you Bill for that script

 

 

On PARISC servers

 

echo "boot_string/S" | adb /stand/vmunix /dev/kmem

 

(Not tested on all servers. Worked for me most of the times I used it)

 

On Itanium boxes grep for Boot

 

grep Boot /var/adm/syslog/syslog.log 

 

Apr  1 09:55:35 ****** vmunix: Boot device's HP-UX HW path is: 0.0.1.0.0.0

 

This will give you the hardware path of boot disk. You can then find the device file using the ioscan -fnH command. Works on 11.31, not tried on the previous versions.

(The information will be logged when the server starts. So if your server is configured to trim the syslog file on regular basis you may have to search for entries corresponding to your last reboot time in your archived syslog files)

 

arunthoray
Occasional Advisor

Re: Boot disk

Still i didn't get any correct answer.

Bill Hassell
Honored Contributor

Re: Boot disk

>> Still i didn't get any correct answer.

 

This isn't helpful at all. What did you try? Did you use grep to look at syslog.log, or did you use my script?  If you did either of those ideas, what was the result? Did you have problems running the script above? Did your computer crash? Was there any error message when you tried the steps above?



Bill Hassell, sysadmin
arunthoray
Occasional Advisor

Re: Boot disk

 

Hi Bill,

 

When i run using your script am getting the following error on 9000/800/rp7420 model server (os 11.31)

Last booted using adb: warning: Object file and memory file versions do not match ...
adb: warning: Symbol lookups may fail.
0x1 (disk10 or c2t0d0
-------------------------------------------------------------------------
but the scripts is working fine on 9000/800/rp4440,ia64 hp superdome server SD32B,(os 11.31)

-----------------------------------------------------------------

grep Boot /var/adm/syslog/syslog.log -> it is not working out any of my server.

Dennis Handly
Acclaimed Contributor

Re: Boot disk

>getting the following error on 9000/800/rp7420 model server (OS 11.31)

 

What does this return?  The same warning messages?

echo "bootdev/x" | adb -n /stand/vmunix /dev/kmem

 

Is /stand/vmunix the kernel you booted with?