Operating System - HP-UX
1753821 Members
8521 Online
108805 Solutions
New Discussion юеВ

Re: Retrieving disk serial number programmatically

 
SOLVED
Go to solution
Nikhil_1
Advisor

Retrieving disk serial number programmatically

Hello,

I am trying to retrieve the disk serial number programmatically.
I saw a post

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

that gives a way (run cstm tool and parse the output).

Can we retrieve the serial number by calling some API in C
or a kernel call?

How does cstm find the serial number? (I tried running tusc,
but couldn't extract much info). Is it doing ioctl? If yes,
then what IOCTL code can be used to get the serial number?

Any help will be appreciated.

With regards,
Nikhil

 

 

P.S. this thread has been moved from Disk to HP-UX > sysadmin. - Hp forum moderator

7 REPLIES 7
Eugeny Brychkov
Honored Contributor

Re: Retrieving disk serial number programmatically

Nikhil,
I saw this information in disk log pages. How to get it from C - ask in languages forum on ITRC
Eugeny
Nikhil_1
Advisor

Re: Retrieving disk serial number programmatically

Thanks Eugeny.
Could you please point me to the exact forum name?

With regards,
Nikhil
Eugeny Brychkov
Honored Contributor
Solution

Re: Retrieving disk serial number programmatically

Nikhil_1
Advisor

Re: Retrieving disk serial number programmatically

Thanks a lot Eugeny!
I have posted my query on that forum.

Do you have any refs/links about the "disk log pages" that I can read? (I am not familiar with this concept).

With regards,
Nikhil
Eugeny Brychkov
Honored Contributor

Re: Retrieving disk serial number programmatically

Unfortunately I have no clue. I guess that these pages are stored in disk's NVRAM or servo area.
I saw SCSI advanced application (don't ask me which one) which can access these pages. Disk is set-up through these log pages - you can find disk size, disk inquiry string, fw revision, disk statistics, caching parameters etc. I remember I killed one Maxtor disk reducing number of cylinders to 1 :o( So please play carefully with them
Eugeny
Eugeny Brychkov
Honored Contributor

Re: Retrieving disk serial number programmatically

Nikhil, try searching vendors' sites: seagate, ibm for low-level disk manuals
Eugeny
Vincent Fleming
Honored Contributor

Re: Retrieving disk serial number programmatically

Nikhil,

The serial number appears in the "mode sense" pages of the device. The mode sense pages are retrieved from the device via direct SCSI commands. You will need to build the SCSI command to retrieve the pages manually - meaning define a struct{} for the record(s), build a CDB, and issue this via the SCSI Pass-Thru interface. The Pass-Thru interface allows you to send raw SCSI commands directly to a device.

It's been years since I've done this myself, but it wasn't all that complicated.

There is lots of docs on how to do this, and it would be too much to post here. Look up the SCSI command specifications on the 'net, and see docs.hp.com for the Pass-Thru interface documentation.

Good luck!
No matter where you go, there you are.