Operating System - HP-UX
1751873 Members
5173 Online
108782 Solutions
New Discussion юеВ

How to List Disks(LUNs) in a System with their Sizes

 
SOLVED
Go to solution
Alzhy
Honored Contributor

How to List Disks(LUNs) in a System with their Sizes

Q quickie...

Is there a tool in HP-UX (similar to EMC's inquire) that lists all disks with thier capacities? I am trying to inventory the LUNs (from an EVA) allocated to an HPUX box. ioscan lists the disks but no capacities. SAM only shows the 1st LUN....

Thanks..
Hakuna Matata.
11 REPLIES 11
Solution

Re: How to List Disks(LUNs) in a System with their Sizes

You need to use 'diskinfo'

The following shell code should give you what you need.

ioscan -funCdisk | awk ' /rdsk/ {print $2}' | while read disk
do
diskinfo $disk
done

It might hang for a moment or two while looking at CD-ROMS.

HTH

Duncan

I am an HPE Employee
Accept or Kudo
Marco Santerre
Honored Contributor

Re: How to List Disks(LUNs) in a System with their Sizes

you'll need to go through each and everyone of them separately, but the command diskinfo will give you the size of your LUN.

#diskinfo /dev/rdsk/cntndn
Cooperation is doing with a smile what you have to do anyhow.
Stefan Farrelly
Honored Contributor

Re: How to List Disks(LUNs) in a System with their Sizes

No, I dont believe there is a tool to do it. You need to write a script to collate this info and display it in one go.

We use EMC's inq.HP (or syminq or inq). Its a small binary and it works fine on HP servers which dont have EMC. Gives a nice single view of all luns and their sizes.
Im from Palmerston North, New Zealand, but somehow ended up in London...
Sundar_7
Honored Contributor

Re: How to List Disks(LUNs) in a System with their Sizes

Hi,

# cd /dev/rdsk
# for DISK in *
do
SIZE=$(diskinfo $DISK | grep size: | awk '{print $2}')
echo "$DISK Capacity: $SIZE Kbytes"
done
#

Pls note that more than one device file can be referring to the same LUN. So a literal addition of all the sizes displayed would not be accurate.

--Sundar.



Learn What to do ,How to do and more importantly When to do ?
Alzhy
Honored Contributor

Re: How to List Disks(LUNs) in a System with their Sizes

Anyone knows if EMC's inquire or syminq is a free tool? Where to download if free?
Hakuna Matata.
Elena Leontieva
Esteemed Contributor

Re: How to List Disks(LUNs) in a System with their Sizes

Also, take a look at this:

Document id: DKKBRC00006641 "Only first LUN of 3rd party disk array visible in SAM"

http://www2.itrc.hp.com/service/cki/docDisplay.do?docLocale=en_US&docId=200000062906734

Elena.
Steven E. Protter
Exalted Contributor

Re: How to List Disks(LUNs) in a System with their Sizes

Duncan(et al) you should probably post that script to Bill McNamara's scripts that sysadmins should not be without thread.

My version of the script showed all disks, though it did hang for a while on the cd-rom.

Another mod would be converting the diskinfo output to Megabytes or Gigabytes.

Good Show.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
John Payne_2
Honored Contributor

Re: How to List Disks(LUNs) in a System with their Sizes

If you mount luns of different sizes, they should show up in SAM. (ie, 3 luns: all 500GB, will only show one, 3 luns: 500GB, 501GB, 502GB, will all show up in SAM.)

Hope it helps.

John
Spoon!!!!
Todd McDaniel_1
Honored Contributor

Re: How to List Disks(LUNs) in a System with their Sizes

Just a thought or 2...

Since your asking Im guessing you don't have syminq/inq commands.

On my EMC frames, all my LUNS are set to a "standard" size. Do you have different sized LUNs in your Storage? It makes life alot easier with BCVs and creating new VGs/LVs.

______________________________________
Here is a script one of our great techs wrote, you can modify it... It includeds the verbose version of the display commands so you might want to remove the -v option.


_______________CUT HERE _____________________________

# cat findspace
#!/sbin/sh
# findspace... to look at ALL disks on the HP box, extract pertinent
# information so that an administator can find out what is in use.
# This program uses "ioscan" to get the disks on the box, then to
# pvdisplay to get the information.
#
#
# syntax is just "findspace [-s]"
# output is to a file /tmp/disk1
# with option -s, the size of the physical extent (normally 4 meg) is printed
# and the allocated physical extents are not printed.
#
# optional printing is: pr -2Ft -l60 -w80 /tmp/disk1
if [ $# -ne "0" ]
then
if [ $1 = "-s" ]
then
SZ=yes
else
echo "\n\n\tUsage: `basename $0` [ -s ] \n"
echo "option -s shows extent size (normally 4meg) rather than allocated
extents"
echo "\n\n" ; exit
fi
fi
hostname > /tmp/disk1
echo "" >> /tmp/disk1
# first, find all disks except "CD-ROM" using ioscan
echo "\n estimate 2 seconds per disk to run.\n\n"
ioscan -fun -C disk | awk '( $1 == "disk" ) && ( $8 !~ /ROM/ ) { print $3
getline
print $1, $2 }' | paste - - > /tmp/crs1
# use that list to get diskinfo and pvdisplay of each disk
exec < /tmp/crs1
while read HDWR DSK RDSK
do
echo $DSK "\t" $HDWR >> /tmp/disk1
diskinfo $RDSK >> /tmp/disk1
pvdisplay -v $DSK >> /tmp/disk1 2>/dev/null
echo "----------------------------------" >> /tmp/disk1
done
# get rid of all of the info that I don't want.
# depends on if I wanted size of sector or know they are all 4 meg
if [ "${SZ}" = "yes" ]
then
ed /tmp/disk1 << DONE
g/current/d
g/free/d
g/Physical volumes/d
g/PV Name/d
g/extents/d
g/Status/d
g/Distribution/d
g/Allocatable/d
g/Allocated/d
g/VGDA/d
g/PV Status/d
g/Stale PE/d
g/SCSI describe of/d
g/vendor:/d
g/product id:/d
g/bytes per sector:/d
g/Timeout/d
g/^ /s///
w
q
DONE
#
else
ed /tmp/disk1 << DONE
g/current/d
g/free/d
g/Physical volumes/d
g/PV Name/d
g/extents/d
g/Status/d
g/Distribution/d
g/Allocatable/d
g/VGDA/d
g/PE Size/d
g/PV Status/d
g/Stale PE/d
g/SCSI describe of/d
g/vendor:/d
g/product id:/d
g/bytes per sector:/d
g/Timeout/d
g/^ /s///
w
q


DONE
fi
#
echo "\n\noutput is in /tmp/disk1\n\n"
######
Unix, the other white meat.