Operating System - HP-UX
1831950 Members
3045 Online
110034 Solutions
New Discussion

How to get disk size for all disk drives on a server.

 
SOLVED
Go to solution
Gino Castoldi_2
Honored Contributor

How to get disk size for all disk drives on a server.

Hi,

Is there a way via a shell script to get the
number of disks on a server and the size of
each disk as well. With this information I can
calculate how much total disk space capacity we have.

Example: A L2000 HP-UX 11.0 server has 6 hard drives that are 18GB each. So we have 108GB
of disk space capacity.

Thank you in advance.
Gino
7 REPLIES 7
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: How to get disk size for all disk drives on a server.

It's actually fairly easy.

1) ioscan -fn -C disk and note the /dev/rdsk/cxtydz device nodes. You may see a CD-ROM listed; ignore it.
2) for each /dev/rdsk/cxtydz do a diskinfo /dev/rdsk/cxtydz.
The diskinfo will list drive capacity as well as other data.

man ioscan,diskinfo for details.

This should get you started, Clay
If it ain't broke, I can fix that.
boley janowski
Trusted Contributor

Re: How to get disk size for all disk drives on a server.

do an:

ioscan -funCdisk

after this you will mostlikely beable to determin the size of each based on the model# of a disk you know they will most likely be most of the same disk, ignore the cdrom. And any disk you are not sure of do a

diskinfo /dev/dsk/c_t_d_

and this will tell you the rest,

Good luck,
Kevin Wright
Honored Contributor

Re: How to get disk size for all disk drives on a server.

lsf /dev/rdsk > /tmp/lsfdisk
for i in `cat /tmp/lsfdisk`
do
diskinfo -v /dev/rdsk/$i
done
CHRIS_ANORUO
Honored Contributor

Re: How to get disk size for all disk drives on a server.

Hi
Do the following:

ioscan -funC disk
diskinfo -v /dev/rdsk/c#t#d#

That will give you required information.
When We Seek To Discover The Best In Others, We Somehow Bring Out The Best In Ourselves.
boley janowski
Trusted Contributor

Re: How to get disk size for all disk drives on a server.

sorry, you need the character device for diskinfo, i left out the "r"

diskinfo /dev/rdsk/c_t_d_
Vincenzo Restuccia
Honored Contributor

Re: How to get disk size for all disk drives on a server.

ioscan -nfkCdisk|grep dev|awk '{print $2}'>/tmp/disks
while read i
do
var=$(diskinfo $i|grep Kbytes|awk '{print $2}')
echo $var+$var|bc

done
MANOJ SRIVASTAVA
Honored Contributor

Re: How to get disk size for all disk drives on a server.

Hi Jino

try this :

ioscan -fnC disk | grep rdsk > /tmp/test
cat test | cut -l 54-69 > /tmp/test1
for i in 'cat /tmp/test1'
do
diskinfo $i
done .


Manoj Srivastava