Is there a struct and/or API on Solaris to determine which drive is currently booted? For example, a Netra 440 can have 4 valid drives, I’d like to know , short of parsing vfstab or prtconf returns, which device is currently booted.

Thanks
John

Tags: , , , ,

Categories: Solaris


2 Responses to “Programatically determining which drive is booted on Solaris?”

  1. feynman_rocks says:

    I would probably try to examine the vfstab.

  2. Daryl P says:

    Another person suggested examining “vfstab”. That
    idea is on the right track, but the implementation
    is wrong.

    /etc/vfstab is human editable and requires some care
    to parse programmatically if you absolutely want to
    “get it right”. Far more friendly is

        /etc/mnttab

    which a binary file, with a binary interface, which
    describes what is actually currently mounted on the
    system.

    The interface you’d use is:

        getmntent

    and of course the mount of interest would be “/”.

    From this you can determine a disk specifier like:

        /dev/dsk/c1t2d0s0

    which tells you it is slice 0 of target 2 on controller 1.

    From the command line, you can get similar info from:

        $ df -k /
        Filesystem kbytes used avail capacity Mounted on
        /dev/dsk/c1t2d0s0 14121387 9314418 4665756 67% /

Leave a Reply