Operating System - HP-UX
1846607 Members
1316 Online
110256 Solutions
New Discussion

Re: script help - identify boot drives

 
SOLVED
Go to solution
Rick Garland
Honored Contributor

script help - identify boot drives

Hi all:

Working with 11.11 & 11.23
Using lvlnboot -v to get the boot drive(s).
If the output is short and simple I can get them no problem. But if the output contains lots of lines with ALT LINKS or inactive VGs then it does not work so well.

Example short output. I can use the following command;
lvlnboot -v | awk 'BEGIN {RS = "^Boot:" ; FS = "\n"} {print $5 $6}' | awk '{print $4 "\n" $5}'

If the output varies then this doesn't work. How to make it so regardless of the output it will work?


# lvlnboot -v
Boot Definitions for Volume Group /dev/vg00:
Physical Volumes belonging in Root Volume Group:
/dev/dsk/c2t1d0 (0/1/1/0.1.0) -- Boot Disk
/dev/dsk/c3t0d0 (0/1/1/1.0.0) -- Boot Disk
Boot: lvol1 on: /dev/dsk/c2t1d0
/dev/dsk/c3t0d0
Root: lvol3 on: /dev/dsk/c2t1d0
/dev/dsk/c3t0d0
Swap: lvol2 on: /dev/dsk/c2t1d0
/dev/dsk/c3t0d0
Dump: lvol2 on: /dev/dsk/c2t1d0, 0
4 REPLIES 4
James R. Ferguson
Acclaimed Contributor
Solution

Re: script help - identify boot drives

Hi Rick:

Try:

# lvlnboot -v|awk '/\/dev/ && /Boot Disk/ {print $1}'

Regards!

...JRF...
Denver Osborn
Honored Contributor

Re: script help - identify boot drives

It all depends on what you're collecting the data for, but you may want to expand James' suggestion to also print the hw_path.

# lvlnboot -v|awk '/\/dev/ && /Boot Disk/ {print $1, $2}'

/dev/dsk/c2t1d0 (0/1/1/0.1.0)
/dev/dsk/c3t0d0 (0/1/1/1.0.0)

If you find yourself sitting at the bch deciding which path you want to boot, c2t1d0 may not help.

-denver

Re: script help - identify boot drives

Not at a system right now, but I seem to recall that if you actually specify the root VG, it doesn't add all the stuff about inactive links etc:

lvlnboot -v /dev/vg00

HTH

Duncan

I am an HPE Employee
Accept or Kudo
Rick Garland
Honored Contributor

Re: script help - identify boot drives

Hey guys - Many thanks!