Operating System - HP-UX
1752401 Members
5597 Online
108788 Solutions
New Discussion

Re: How to see the disk booted from. or the boot disk is in use currently. ?

 
rveri-admin
Frequent Advisor

How to see the disk booted from. or the boot disk is in use currently. ?

EXperts,

 

How to check which boott disk is system booted from in a mirrored disk environment . in 11.31 hp-ux. 

 

 

In 11.23 there is a command :

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

 

 

Is there anything in  hp-ux 11.31 to figure this out, which boot_disk system currently booted from & using. 

 

Thanks,

 

4 REPLIES 4
Torsten.
Acclaimed Contributor

Re: How to see the disk booted from. or the boot disk is in use currently. ?

From syslog:

 

$ grep -i "boot device" /var/adm/syslog/syslog.log
Feb  8 14:03:15 td193 vmunix: Boot device's HP-UX HW path is: 0.4.1.0.5000c500021780bd.0

$ /usr/sbin/setboot
Primary bootpath : 0/4/1/0.0x5000c500021780bd.0x0 (/dev/rdisk/disk5)



 

 

This tells you the boot device used: /dev/rdisk/disk5


Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
rveri-admin
Frequent Advisor

Re: How to see the disk booted from. or the boot disk is in use currently. ?

Hi Torsten, Thanks a lot, As the syslog.log is rotating and the current syslog is the trimmed syslog.log , so I dont see no "boot device" entry in the syslog.log . - $ grep -i "boot device" /var/adm/syslog/syslog.log returning nothing. - Is there any other way to figure it out. Thanks, Reveri..
Torsten.
Acclaimed Contributor

Re: How to see the disk booted from. or the boot disk is in use currently. ?

Even if you rotate the logs, you still have them, right?


Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
Bill Hassell
Honored Contributor

Re: How to see the disk booted from. or the boot disk is in use currently. ?

The classic methods are just not reliable...

 

-- dmesg (limited buffer, boot message rolls off the top)

-- syslog (log truncation may lose the info, syslog.conf may redirect to another file, etc)

-- setboot (shows what is desired but is not a log...the system may have been manually booted)

 

So the only dependable way is to ask the current kernel. Unfortunately, there have been several changes from the classic methods that worked back in 10.01 through 11.11.  Here are the steps (snipped from the attached bootinfo.sh script):

 

MYREV=$(uname -r | cut -d. -f 2-3 | tr -d .)
echo "bootstring using adb:"
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, is 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" |
       grep -v '.pt' |
       awk '{print $NF}')

# for 11.31, minor is for the /dev/disk 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

 

The differences are:

 

-- adb options for 11.23 and higher

-- the bootstring is now an ID with the minor number for the /dev/disk devices

-- the matching minor number may show devname and devname.pt

 

Here's a sample output from the attached bootinfo script:

 

 # bootinfo

bootstring using adb:
   Last booted using 0x100001c (disk41 or c0t1d0)

Boot disks and AUTO file boot command:
   /dev/disk/disk5_p2
      BootCommand: "boot vmunix -lq"
   /dev/disk/disk41_p2
      BootCommand: "boot vmunix -lq"

boot PATHS:
   Primary bootpath    = 0/1/1/0.0.0.1.0, /dev/rdsk/c0t1d0
                       = 0/1/1/0.0x5000c5000abec39d.0x0, /dev/rdisk/disk41
                       = (disk) 64000/0xfa00/0x13

   Alternate bootpath  = 0/1/1/0.0.0.2.0, /dev/rdsk/c0t2d0
                       = 0/1/1/0.0x5000c50007153089.0x0, /dev/rdisk/disk5
                       = (disk) 64000/0xfa00/0x12

   HA Alt bootpath     = 0/1/1/0.0.0.1.0, /dev/rdsk/c0t1d0
                       = 0/1/1/0.0x5000c5000abec39d.0x0, /dev/rdisk/disk41
                       = (disk) 64000/0xfa00/0x13


Automatic boot settings from setboot:
   Autoboot is ON (enabled)


lvlnboot -v:

   Boot Definitions for Volume Group /dev/vg00:
   Physical Volumes belonging in Root Volume Group:
        /dev/disk/disk5_p2 -- Boot Disk
        /dev/disk/disk41_p2 -- Boot Disk
   Boot: lvol1  on:     /dev/disk/disk5_p2
                        /dev/disk/disk41_p2
   Root: lvol3  on:     /dev/disk/disk5_p2
                        /dev/disk/disk41_p2
   Swap: lvol2  on:     /dev/disk/disk5_p2
                        /dev/disk/disk41_p2
   Dump: lvol2  on:     /dev/disk/disk5_p2, 0

 

This script runs on version 10 and all versions of 11 up to 11.31, PARISC or IA64.

 

 



Bill Hassell, sysadmin