Get # of disks as non-root

I'm trying to figure if there are commands I can run as non-root/non-privileged users to figure out the number of disks. I know I can use format but it needs root. Any idea?

iostat -En

As far as I know , nothing will work as non privileged user.
But you can run as non privileged user

$/usr/sbin/prtconf  

and list disk instances

Thanks for the replies!

I should clarify what I'm trying to do...I'm trying to write a script to do some simple monitoring. I want to cron and execute it as non-root. Executing those commands do show the drives but there's no easy way to programatically parse the output...I should've been more clear with what I was trying to achieve :frowning:

I'm not sure what are you about precisely.
But this script might help

Thanks for the link h@foorsa.biz.

I tried running it on my system and it shows this:

c0t0d0s0 --- sd0
c0t2d0s0 --- sd1
c1t0d0s0 --- sd2

...and when I ran "format", it shows this:

# format
Searching for disks...done


AVAILABLE DISK SELECTIONS:
       0. c0t0d0 <SUN72G cyl 14087 alt 2 hd 24 sec 424>
          /pci@780/pci@0/pci@9/scsi@0/sd@0,0
       1. c0t2d0 <SEAGATE-ST9146802SS-0003 cyl 33916 alt 2 hd 8 sec 1056>
          /pci@780/pci@0/pci@9/scsi@0/sd@2,0
Specify disk (enter its number):

So it looks like the script is reporting 3 drives while format shows 2? :confused:

what is the output of "rmformat"? the 3rd drive could be your DVD or another external device...

I think you are right:

# rmformat
Looking for devices...
     1. Logical Node: /dev/rdsk/c1t0d0s2
        Physical Node: /pci@7c0/pci@0/pci@1/pci@0/ide@8/sd@0,0
        Connected Device: MATSHITA CD-RW  CW-8124   DZ13
        Device Type: <Unknown>

Is there a reliable way to get the number of disks as non-root?

What's wrong with the various solutions already suggested ?

iostat -En

The output is difficult to reliably script to parse the number of hard drives.

prtconf

Similar to iostat. It's difficult to reliably script to parse the number of hard drives.

The script h@foorsa.biz provided includes the DVD ROM. I suppose I can take the script, run rmformat, find the number of DVD ROM and then subtract from the output of the script. :b:

For something parseable, you can use:

kstat -c device_error