System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

How do you determine the current boot path/device

SOLVED
Go to solution

How do you determine the current boot path/device

What I'm looking to be able to do is walk up to a running system and from the OS tell what is the current boot drive, path, device or something that will tell me which drive the system is currently booted from.

I've run through some of the easy ones such as setboot, lvlnboot and checking syslog.
None of them give the current boot device.

Right at the start of boot on the console it lists the starting boot path but I would have to be looking at the console during boot to catch that.

This seemed like a simple thing to me when I was asked but the answer has been more elusive than I originally thought.

Thanks,
Travis
15 REPLIES
Tim Nelson
Honored Contributor

Re: How do you determine the current boot path/device

try this.
MODEL=`uname -m`
if [[ $MODEL = "ia64" ]]
then
echo "--- IA64 System ---"
echo "Syslog says"
grep Boot /var/adm/syslog/syslog.log
echo "\nkcpath says:"
kcpath
echo "\nADB from /stand/vmunix says:"
MINOR=`echo "bootdev/x"|adb /stand/vmunix /dev/kmem|awk 'NR == 2 {print $1}'|cut -c 5-10`
echo "\n$MINOR Translated to:"
ls -l /dev/dsk/|grep $MINOR
DEV=`ls -l /dev/dsk|awk '/'$MINOR'/ {print $10}'`
echo "Boot device is: \c"
lssf /dev/dsk/$DEV|awk '{print $15" "$16}'


else
echo "--- PA-RISC System ---"
echo "\nADB from /stand/vmunix says:"
echo boot_string/S|adb /stand/vmunix /dev/mem
echo "\nkmpath says:"
kmpath
fi
Patrick Wallek
Honored Contributor

Re: How do you determine the current boot path/device

This works on HP-UX 11.0, 11.11 and 11.23 PA/RISC:

echo "boot_string/S" | adb -k /stand/vmunix /dev/kmem
Bill Hassell
Honored Contributor
Solution

Re: How do you determine the current boot path/device

PARISC is a simple adb command. IA64 is a real pain...you get part of the minor number as the kernel's reference, then match it with a device file and then there's all that DSF stuff for 11.31, so I wrote a script to give you the details (attached). Here are two examples, PARISC followed by IA64:

bootstring using adb:
Last booted using disk(0/0/2/0.6.0.0.0.0.0;0)/stand/vmunix

Boot disks and AUTO file boot command:
/dev/dsk/c1t6d0
BootCommand: "hpux -lq"
/dev/dsk/c2t6d0
BootCommand: "hpux -lq"

boot PATHS:
Primary bootpath = 0/0/2/0.6.0, /dev/dsk/c1t6d0
(disk) SEAGATE ST318404LC

Alternate bootpath = 0/0/1/0.0.0, /dev/rmt/0mn
(tape) HP C1537A


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


lvlnboot -v:

Boot Definitions for Volume Group /dev/vg00:
Physical Volumes belonging in Root Volume Group:
/dev/dsk/c1t6d0 (0/0/2/0.6.0) -- Boot Disk
/dev/dsk/c2t6d0 (0/0/2/1.6.0) -- Boot Disk
Boot: lvol1 on: /dev/dsk/c1t6d0
/dev/dsk/c2t6d0
Root: lvol3 on: /dev/dsk/c1t6d0
/dev/dsk/c2t6d0
Swap: lvol2 on: /dev/dsk/c1t6d0
/dev/dsk/c2t6d0
Dump: lvol2 on: /dev/dsk/c1t6d0, 0


===========================================

bootstring using adb:
Last booted using 0x1000004 (disk5 or c0t0d0)

Boot disks and AUTO file boot command:
/dev/disk/disk5_p2
BootCommand: "hpux"
/dev/disk/disk10_p2
BootCommand: "hpux"

boot PATHS:
Primary bootpath = 0/1/1/0.0.0.0.0, /dev/rdsk/c0t0d0
= 0/1/1/0.0x5000c50007153089.0x0, /dev/rdisk/disk5
= (disk) 64000/0xfa00/0x1

Alternate bootpath = 0/1/1/0.0.0.1.0, /dev/rdsk/c0t1d0
= 0/1/1/0.0x5000c50007141ad5.0x0, /dev/rdisk/disk10
= (disk) 64000/0xfa00/0x0

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


Automatic boot settings from setboot:
Autoboot is OFF (disabled)


lvlnboot -v:

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


Bill Hassell, sysadmin
Anoop Sivan
Frequent Advisor

Re: How do you determine the current boot path/device

Hi
We can find currently from which boot disk the server is booted as below

# uname -a
HP-UX rx26-185 B.11.31 U ia64 3025899524 unlimited-user license

[rx26-185]/
# dmesg | grep -i boot
Boot device's HP-UX HW path is: 0.1.1.1.2.0
[rx26-185]/
# ioscan -fnH 0.1.1.1.2.0
Class I H/W Path Driver S/W State H/W Type Description
=====================================================================
disk 3 0/1/1/1.2.0 sdisk CLAIMED DEVICE HP 73.4GST373454LC
/dev/dsk/c3t2d0 /dev/dsk/c3t2d0s2 /dev/rdsk/c3t2d0 /dev/rdsk/c3t2d0s2
/dev/dsk/c3t2d0s1 /dev/dsk/c3t2d0s3 /dev/rdsk/c3t2d0s1 /dev/rdsk/c3t2d0s3
[rx26-185]/
EmmanuelK2
Advisor

Re: How do you determine the current boot path/device

Hi Travis,
On 11.31, the command "lvlnboot -v" shows you the current boot device, root, swap and dump.
regards
Emmanuel
SoorajCleris
Honored Contributor

Re: How do you determine the current boot path/device

Hi ,

Simple ...

#dmesg | grep HW

Regards,
Sooraj
"UNIX is basically a simple operating system, but you have to be a genius to understand the simplicity" - Dennis Ritchie
Bill Hassell
Honored Contributor

Re: How do you determine the current boot path/device

> dmesg | grep -i boot

This is not very reliable. dmesg is a small buffer in kernel memory and old information is erased to make room for new messages. The boot path information in dmesg is only valid right after you boot...several weeks from now, it can disappear.


Bill Hassell, sysadmin

Re: How do you determine the current boot path/device

One really important bit of information I left out is that I'm trying to figure it out on Itanium systems.
Most of the methods mentioned do work on RISC but not on Itanium.

I've still not found a reliable way to get the information from an Itanium box.
Sometimes syslog catches it but about 50% of the time it doesn't.
I thought at one point I might be able to change when syslogd starts so it would reliably capture the boot path but I haven't had time to work it in the last week.

Bill - I may give you a call directly about this, I'm the same Travis Harp with Northrop who bugs you from time to time.
Jayakrishnan G Naik
Trusted Contributor

Re: How do you determine the current boot path/device

Hi Travis Harp,

I just have my observation here about the OS disks and I have checked few HP ux servers with root disk mirroring.

I have executed sar & iostat command which shows comparably higher io on the presently used disk than the mirror. Based on this output I confirmed that the system is using the disk having higher io activity.

sar -d 5 5

See if this works for you too. This is purely based on what I observed on few HP-UX servers and I would appreciate if somebody have their objections/ comments/observations
on what I have here.

Thanks & Regards
Jayakrishnan G Naik
Bill Hassell
Honored Contributor

Re: How do you determine the current boot path/device

> Jayakrishnan
> I have executed sar & iostat command which shows comparably higher io on the presently used disk than the mirror.

Correct. The mirror is only written during normal operation. All reads will come from the primary.

As far as Itanium, the above procedure mentioned about tracking down the minor number from the adb...bootdev result. As seen in the bootinfo script above, you get the adb results, extract the device number (something like 0x1000004) digits, then search for a match of the minor number in the disk devicefiles.

Not straightforward, but everything about booting in Itanium is convoluted...


Bill Hassell, sysadmin
Torsten.
Acclaimed Contributor

Re: How do you determine the current boot path/device

Usually this can be found in syslog and dmesg (if still not overwritten):



Boot device's HP-UX HW path is: 0/7/1/0/4/0.0.0


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!   
Torsten.
Acclaimed Contributor

Re: How do you determine the current boot path/device

Note: the path in 11.31 is in agile format, e.g.


Boot device's HP-UX HW path is: 0.0.c.1.0.4.0.5000112345678123.4001000000000000

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!   

Re: How do you determine the current boot path/device

Bill -
I tried to attached script and I'm getting usage errors.
Here is the output:
bootstring using adb:
Last booted using ioscan: /dev/disk/ is not a special file
ioscan: /dev/disk/ is not a special file
0xffffffff ( or )

Boot disk and AUTO file boot command:

WARNING: The AUTO file is missing in the LIF area!
lifls -l
USAGE: lifls [-C -l -i -v -L -b BlockList] volname[:filename]

boot PATHS:
ioscan: option requires an argument -- H
usage: ioscan [-N] [-k | -u] [-e] [-d driver | -C class] [-I instance] [-H hw_path]
[-l] [-A] [-f | -F[F] [-n]] [devfile]
[-b] -M driver -H hw_path [-I instance]
[-t]
-P [-d driver | -C class] [-I instance] [-H hw_path] [devfile]
-m lun [-F] [-d driver | -C class] [-I instance] [-H lun hw_path] [devfile]
[-F]-m dsf [devfile]
-m hwpath [-F] [-H hw_path]
-s
-r -H hw_path
-B
-U
-a [-F]
-k: show kernel structures; don't scan hardware
-N: show devices present in agile view
-u: show usable devices; don't scan hardware
-e: on IPF systems, show EFI device paths when available;
on PA-RISC systems, show PA device paths when available
-d: show hardware controlled by specified driver
-C: show hardware in specified class
-I: show hardware with specified instance
-H: show hardware at specified path
-f: give full listing
-F: give listing separated by 'separators'
if specified twice (-FF), prints additional fields
-n: show device file names
-l: show only locally connected devices
-t: show date and time of previous hardware scan
or: ioscan [-b] -M driver -H hw_path [-I instance]
-b: force-configure with deferred binding
-M: force-configure specified drivers
-H: force-configure specified hardware path
-A: show the alias_path assigned to the hardware path
-I: force-configure specified hardware instance
or: ioscan -P [-d driver | -C class] [-I instance] [-H hw_path] [devfile]
-P: show property
or: ioscan -m lun [-F] [-d driver | -C class] [-I instance] [-H lun hw_path] [devfile]
-m: show mappings
or: ioscan [-F] -m dsf [devfile]
or: ioscan -m hwpath [-F] [-H hw_path]
or: ioscan -s
-s: show stale entries present in ioconfig files
or: ioscan -r -H hw_path
-r: remove deferred binding flag
or: ioscan -B
-B: list nodes with deferred binding flag set
or: ioscan -U
-U: initiate a scan on unclaimed nodes
-a: shows information about thread 0 for a processor with Hyper Threading feature
ioscan: option requires an argument -- H
usage: ioscan [-N] [-k | -u] [-e] [-d driver | -C class] [-I instance] [-H hw_path]
[-l] [-A] [-f | -F[F] [-n]] [devfile]
[-b] -M driver -H hw_path [-I instance]
[-t]
-P [-d driver | -C class] [-I instance] [-H hw_path] [devfile]
-m lun [-F] [-d driver | -C class] [-I instance] [-H lun hw_path] [devfile]
[-F]-m dsf [devfile]
-m hwpath [-F] [-H hw_path]
-s
-r -H hw_path
-B
-U
-a [-F]
-k: show kernel structures; don't scan hardware
-N: show devices present in agile view
-u: show usable devices; don't scan hardware
-e: on IPF systems, show EFI device paths when available;
on PA-RISC systems, show PA device paths when available
-d: show hardware controlled by specified driver
-C: show hardware in specified class
-I: show hardware with specified instance
-H: show hardware at specified path
-f: give full listing
-F: give listing separated by 'separators'
if specified twice (-FF), prints additional fields
-n: show device file names
-l: show only locally connected devices
-t: show date and time of previous hardware scan
or: ioscan [-b] -M driver -H hw_path [-I instance]
-b: force-configure with deferred binding
-M: force-configure specified drivers
-H: force-configure specified hardware path
-A: show the alias_path assigned to the hardware path
-I: force-configure specified hardware instance
or: ioscan -P [-d driver | -C class] [-I instance] [-H hw_path] [devfile]
-P: show property
or: ioscan -m lun [-F] [-d driver | -C class] [-I instance] [-H lun hw_path] [devfile]
-m: show mappings
or: ioscan [-F] -m dsf [devfile]
or: ioscan -m hwpath [-F] [-H hw_path]
or: ioscan -s
-s: show stale entries present in ioconfig files
or: ioscan -r -H hw_path
-r: remove deferred binding flag
or: ioscan -B
-B: list nodes with deferred binding flag set
or: ioscan -U
-U: initiate a scan on unclaimed nodes
-a: shows information about thread 0 for a processor with Hyper Threading feature
ioscan: Only one devfile allowed
usage: ioscan [-N] [-k | -u] [-e] [-d driver | -C class] [-I instance] [-H hw_path]
[-l] [-A] [-f | -F[F] [-n]] [devfile]
[-b] -M driver -H hw_path [-I instance]
[-t]
-P [-d driver | -C class] [-I instance] [-H hw_path] [devfile]
-m lun [-F] [-d driver | -C class] [-I instance] [-H lun hw_path] [devfile]
[-F]-m dsf [devfile]
-m hwpath [-F] [-H hw_path]
-s
-r -H hw_path
-B
-U
-a [-F]
-k: show kernel structures; don't scan hardware
-N: show devices present in agile view
-u: show usable devices; don't scan hardware
-e: on IPF systems, show EFI device paths when available;
on PA-RISC systems, show PA device paths when available
-d: show hardware controlled by specified driver
-C: show hardware in specified class
-I: show hardware with specified instance
-H: show hardware at specified path
-f: give full listing
-F: give listing separated by 'separators'
if specified twice (-FF), prints additional fields
-n: show device file names
-l: show only locally connected devices
-t: show date and time of previous hardware scan
or: ioscan [-b] -M driver -H hw_path [-I instance]
-b: force-configure with deferred binding
-M: force-configure specified drivers
-H: force-configure specified hardware path
-A: show the alias_path assigned to the hardware path
-I: force-configure specified hardware instance
or: ioscan -P [-d driver | -C class] [-I instance] [-H hw_path] [devfile]
-P: show property
or: ioscan -m lun [-F] [-d driver | -C class] [-I instance] [-H lun hw_path] [devfile]
-m: show mappings
or: ioscan [-F] -m dsf [devfile]
or: ioscan -m hwpath [-F] [-H hw_path]
or: ioscan -s
-s: show stale entries present in ioconfig files
or: ioscan -r -H hw_path
-r: remove deferred binding flag
or: ioscan -B
-B: list nodes with deferred binding flag set
or: ioscan -U
-U: initiate a scan on unclaimed nodes
-a: shows information about thread 0 for a processor with Hyper Threading feature
Primary bootpath = 0/2/1/0.0.0.5.0, /dev/rdsk/c0t5d0
= 0/2/1/0.0x500000e01e463872.0x0, /dev/rdisk/disk1794
= (disk) 64000/0xfa00/0xdd

Alternate bootpath = 0/2/1/0.0.0.6.0, /dev/rdsk/c0t6d0
= 0/2/1/0.0x5000c50004374551.0x0, /dev/rdisk/disk1796
= (disk) 64000/0xfa00/0xe1

HA Alt bootpath = ,
= ,
= ()


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


lvlnboot -v:
Bill Hassell
Honored Contributor

Re: How do you determine the current boot path/device

Looks like you need to update your bootable disks. lvlnboot -v is not reporting anything and several parts of the script depend on having valid boot values.


Bill Hassell, sysadmin
Bill Hassell
Honored Contributor

Re: How do you determine the current boot path/device

Also looks like setboot is empty, which means your system won't reboot without interaction.


Bill Hassell, sysadmin