Operating System - HP-UX
1829734 Members
1816 Online
109992 Solutions
New Discussion

Get a list of disks on Hp-ux

 
vijay_16
New Member

Get a list of disks on Hp-ux

Hi all,
I am trying to generate a list of disks on the system within my C program. On Solaris, I can do this by seeking to the kernel symbol _top_devinfo in /dev/kmem and walking down the structure. Is there an equivalent on HP-UX?

I know I could use ioscan -F -C disk, but I would rather not if it can be avoided. I notice from using trace that ioscan uses ioctls to /dev/config. Are there published ways of accessing /dev/config?

Thanks for any help,
Vijay
The early bird gets the worm, but the second mouse gets the cheese.
13 REPLIES 13
Eugeny Brychkov
Honored Contributor

Re: Get a list of disks on Hp-ux

Vijay,
I agree with you not to use ioscan. I believe there's a way like you mentioned, but as soon as I'm not so hpux deep person, I would propose another way:
- list /dev/rdsk directory to see if there are device files for disks which are accessible for OS;
- issue 'lssf /dev/rdsk/cXtYdZ' to get hardware path;
- issue 'diskinfo -v /dev/rdsk/cXtYdZ' to get low-level disk info (size, model, bps, firmware level etc).
Of course you will not be able to list disks if there're no device files generated for them, but this can be solved issuing 'insf -e' prior to all these actions :o)
Eugeny
Sridhar Bhaskarla
Honored Contributor

Re: Get a list of disks on Hp-ux

Hi,

Will "ioscan -fun" work for you?. You can run it as an ordinary user.

-Sri

You may be disappointed if you fail, but you are doomed if you don't try
Paul Sperry
Honored Contributor

Re: Get a list of disks on Hp-ux

try
ioscan -fnk -C disk
the k option = show kernel structures; don't scan hardware
Eugeny Brychkov
Honored Contributor

Re: Get a list of disks on Hp-ux

Paul is right, this is one more way. Not to use ioscan to SCAN hardware is because if there is another concurrent ioscan will be run then these ioscans (and maybe whole system) may hang
Eugeny
Paula J Frazer-Campbell
Honored Contributor

Re: Get a list of disks on Hp-ux

Hi

Try looking at vgdisplay and lvoldisplay.

Paula
If you can spell SysAdmin then you is one - anon
vijay_16
New Member

Re: Get a list of disks on Hp-ux

Thank you for the replies.

Ioscan -fnk -C disk is an option. When I asked the question, I was mainly wondering if there was some way to directly get the information from the kernel instead of going through ioscan.

I need to know the device file name, and I don't like the way ioscan displays them. So if I could get the information directly, it would be better.

Thanks,
Vijay
The early bird gets the worm, but the second mouse gets the cheese.
Gordon Davis
Occasional Advisor

Re: Get a list of disks on Hp-ux

Vijay,

Would the following work for you?

ioscan -fnk -C disk | grep /dev/dsk | awk '{ print $1 }'

Gordon
Michael Tully
Honored Contributor

Re: Get a list of disks on Hp-ux

In this posting there are a few scripts that give you information on what disks you have and also there scripts identifying which ones are used.

http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x026250011d20d6118ff40090279cd0f9,00.html
Anyone for a Mutiny ?
Rajeev  Shukla
Honored Contributor

Re: Get a list of disks on Hp-ux

Hi Vijay,
Yes there is, try using ioconfig C command which gives you a structure called ioconfig_entry defined in header file.
You can get all information from there.

Cheers
Rajeev
vijay_16
New Member

Re: Get a list of disks on Hp-ux

Rajeev,
This sounds promising except I don't have sys/ioconfig.h on any of 3 boxes I have. sys/ioparams.h is similar...
Any ideas?
Thanks,
Vijay
The early bird gets the worm, but the second mouse gets the cheese.
Rajeev  Shukla
Honored Contributor

Re: Get a list of disks on Hp-ux

You are right Vijay. Infact i never used this but man pages show the file as what i wrote.
Also if you go through the header file ioparms.h it tell about all such structure to extract information. I think this should solve the issue.
(i think the structure name also which i gave is different now in ioparms.h its ioconfig)

Cheers
Rajeev
harry d brown jr
Honored Contributor

Re: Get a list of disks on Hp-ux

try

man pstat


live free or die
harry
Live Free or Die
Khalid A. Al-Tayaran
Valued Contributor

Re: Get a list of disks on Hp-ux


Hi,

Use: ioscan -fnC disk


or use the LVMCollect script found in the scripts thread:

http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x026250011d20d6118ff40090279cd0f9,00.html

Bye...