Search code examples
unixcommand-line-interfacesolarisboot

How to programmatically determine which is the boot disk on Solaris/illumos?


On a test server there are two Samsung 960 Pro SSDs, exactly same maker, model and size. On both I've installed a fresh install of exactly the same OS, OmniOS r15026.

By pressing F8 at POST time, I can access the motherboard BOOT manager, and choose one of the two boot drives. Thus, I know which one the system booted from.

But how can one know programmatically, after boot, which is the boot disk?

It seems that is:

Does Solaris/illumos offer some introspective hooks to determine which is the boot disk?

Is it possible to programmatically determine which is the boot disk on Solaris/illumos?

A command line tool would be fine too.


Edit 1: Thanks to @andrew-henle, I have come to know command eeprom.

As expected it is available on illumos, but on test server with OmniOS unfortunately it doesn't return much:

root@omnios:~# eeprom
keyboard-layout=US-English
ata-dma-enabled=1
atapi-cd-dma-enabled=1
ttyd-rts-dtr-off=false
ttyd-ignore-cd=true
ttyc-rts-dtr-off=false
ttyc-ignore-cd=true
ttyb-rts-dtr-off=false
ttyb-ignore-cd=true
ttya-rts-dtr-off=false
ttya-ignore-cd=true
ttyd-mode=9600,8,n,1,-
ttyc-mode=9600,8,n,1,-
ttyb-mode=9600,8,n,1,-
ttya-mode=9600,8,n,1,-
lba-access-ok=1

root@omnios:~# eeprom boot-device
boot-device: data not available.

Solution on OmniOS r15026

Thanks to @abarczyk I was able to determine the correct boot disk.

I had to use a slightly different syntax:

root@omnios:~# /usr/sbin/prtconf -v | ggrep -1  bootpath
          value='unix'
      name='bootpath' type=string items=1
          value='/pci@38,0/pci1022,1453@1,1/pci144d,a801@0/blkdev@w0025385971B16535,0:b

With /usr/sbin/format, I was able to see entry corresponds to

  16. c1t0025385971B16535d0 <Samsung-SSD 960 PRO 512GB-2B6QCXP7-476.94GB>
      /pci@38,0/pci1022,1453@1,1/pci144d,a801@0/blkdev@w0025385971B16535,0

which is correct, as that is the disk I manually selected in BIOS.

Thank you very much to @abarczyk and @andrew-henle to consider this and offer instructive help.


Solution

  • The best way to find the device from which the systems is booted is to check prtconf -vp output:

    # /usr/sbin/prtconf -vp | grep bootpath
            bootpath:  '/pci@0,600000/pci@0/scsi@1/disk@0,0:a'