Listing Disks in Solaris

  • Follow


Hi 
How can I programmatically list disks and their sizes in Solaris? 
Is there a way to extract lets say scsi disks from that list?
Thanks
0
Reply hamadani 9/30/2003 10:53:32 PM

"babak" <hamadani@uclink.berkeley.edu> wrote in message
news:bb6f754a.0309301453.76cd8e82@posting.google.com...
> How can I programmatically list disks and their sizes in Solaris?
> Is there a way to extract lets say scsi disks from that list?

You would typically use the facilities provided by libdevinfo (which reads
the kernel device tree) to do this. Not sure about extracting SCSI disks
only, but I guess you could try a SCSI enquiry against each.

Cheers,
Shaun


0
Reply Shaun 9/30/2003 11:15:30 PM


hamadani@uclink.berkeley.edu (babak) wrote in message news:<bb6f754a.0309301453.76cd8e82@posting.google.com>...
> Hi 
> How can I programmatically list disks and their sizes in Solaris? 
> Is there a way to extract lets say scsi disks from that list?

I doubt there is a ready command for this.
The easiest, IMHO, would be to write a script that parses 
output of "format" (which can be run non-interactively and gives
the list of disks and their sizes - well, at least one can 
calculate the sizes, assuming all sectors are 512 bytes).
"format" also gives the device path, from which the driver name 
can be derived. Knowing which drivers are SCSI ones 
(SUNW,fas SUNW,scsi etc.), helps to select the SCSI disks.

Regards,
Andrei
0
Reply aryzhov 10/1/2003 2:40:36 PM

aryzhov@my-deja.com (aryzhov) wrote in message news:<7ca75749.0310010640.cd3ec11@posting.google.com>...
> hamadani@uclink.berkeley.edu (babak) wrote in message news:<bb6f754a.0309301453.76cd8e82@posting.google.com>...
> > Hi 
> > How can I programmatically list disks and their sizes in Solaris? 
> > Is there a way to extract lets say scsi disks from that list?
> 
> I doubt there is a ready command for this.
> The easiest, IMHO, would be to write a script that parses 
> output of "format" (which can be run non-interactively and gives
> the list of disks and their sizes - well, at least one can 
> calculate the sizes, assuming all sectors are 512 bytes).
> "format" also gives the device path, from which the driver name 
> can be derived. Knowing which drivers are SCSI ones 
> (SUNW,fas SUNW,scsi etc.), helps to select the SCSI disks.
> 
> Regards,
> Andrei

guess iostat -En might help you if you want the sizes of disks(not the
size of slices in disk).
 For more info man iostat.
0
Reply nicole_learning_sola 10/1/2003 7:46:47 PM

"Shaun Clowes" <delius@no.spam.for.me.progsoc.org> wrote in message
news:m8oeb.53$_84.3343@news.optus.net.au...
>
> "babak" <hamadani@uclink.berkeley.edu> wrote in message
> news:bb6f754a.0309301453.76cd8e82@posting.google.com...
> > How can I programmatically list disks and their sizes in Solaris?
> > Is there a way to extract lets say scsi disks from that list?
>
> You would typically use the facilities provided by libdevinfo (which reads
> the kernel device tree) to do this. Not sure about extracting SCSI disks
> only, but I guess you could try a SCSI enquiry against each.

Sorry, I missed the bit about sizes, that can be easily retrieved from the
vtoc, check out read_vtoc(3X) or the ioctl it calls (DKIOCGEOM) in dkio(7I)

Cheers,
Shaun


0
Reply Shaun 10/1/2003 10:15:42 PM

4 Replies
440 Views

(page loaded in 0.058 seconds)

Similiar Articles:













7/29/2012 9:08:52 AM


Reply: