General
cancel
Showing results for 
Search instead for 
Did you mean: 

ioctl call on HPUX to get tape device LUN, Target ID and Bus Number

SOLVED
Go to solution
Navecric
Occasional Advisor

ioctl call on HPUX to get tape device LUN, Target ID and Bus Number

Hi,

Can some one please let me know if there is a way to get the SCSI tape device information like the Target ID, LUN number, Bus number using an ioctl call on the raw device file ( similar to SIOC_INQUIRY which gives us the vendor and product name).

"ioscan -fun" gives us the above information as the H/W Path, But I'm looking for an ioctl that provides the information.

Any help is highly appreciated

Thanks,
Naveen.
6 REPLIES
Laurent Menase
Honored Contributor
Solution

Re: ioctl call on HPUX to get tape device LUN, Target ID and Bus Number

Hi
To my knowledge, there is no such API
the only way looks to be to popen() the "ioscan -fnkC disk", or "ioscan -funC disk"
and process the output.

you can also process /stand/ioconfig like indicated in man ioconfig.
Navecric
Occasional Advisor

Re: ioctl call on HPUX to get tape device LUN, Target ID and Bus Number

Hi Laurent,

Thanks for the reply. Yeah, Even i have found that there is no ioctl call that gives you the LUN, Target ID, Bus number . so, I have found a way to get these information using the major number and minor number of the device file. I think that would do it for me.

Now I have got another issue now with open command on tape device file.

I have a tape library with tape drives and there is no volume loaded in any of these drives. When I issue a open command on one of the device file of a tape drive , I'm getting an error saying "No such device or address".

And the mt output says that "the tape media is not present"
Drive: IBM ULTRIUM-TD3
Format:
Status: Tape media is not present
File: 0
Block: 0

But, When I load a volume in to one of the tape drives and issue a open command, its working fine and i could use any ioctl on that tape device.

So, Is it like we can do an open on a tape device file only when a volume is loaded in the tape drive. And How is iostat giving us the information even when there is no volume loaded in the tape drive .

Thanks,
Naveen


VK2COT
Honored Contributor

Re: ioctl call on HPUX to get tape device LUN, Target ID and Bus Number

Hello,

If you are using HP-UX 11.31, you have an excellent tool. For example, start with this
command:

# scsimgr -get_info -D /dev/rtape/tape0_BEST

scsimgr(1M) is very powerful.

Cheers,

VK2COT
VK2COT - Dusan Baljevic
Laurent Menase
Honored Contributor

Re: ioctl call on HPUX to get tape device LUN, Target ID and Bus Number

what device do you open and what device do you make the mt too?

Navecric
Occasional Advisor

Re: ioctl call on HPUX to get tape device LUN, Target ID and Bus Number

@ Laurent

I did an mt and open on one of the tape drive device files listed by the "ioscan -funC tape" command.

tape 77 ***** stape CLAIMED DEVICE IBM ULTRIUM-TD3
/dev/rmt/77m /dev/rmt/77mn /dev/rmt/c13t3d6BEST /dev/rmt/c13t3d6BESTn
/dev/rmt/77mb /dev/rmt/77mnb /dev/rmt/c13t3d6BESTb /dev/rmt/c13t3d6BESTnb


I have tried the mt and open on all the device files listed above for the tape drive but with the same issue.

and mt rew is giving the same error.

bash-4.0$ mt -f /dev/rmt/77mb rew
/dev/rmt/77mb: No such device or address

Thanks,
Naveen
Navecric
Occasional Advisor

Re: ioctl call on HPUX to get tape device LUN, Target ID and Bus Number

@VK2COT

Thanks for the reply. I'm using 11.31 and the tool is really helpful.

But I'm looking for an ioctl call or a C function that gives the information as displayed by the tool for my application.

Can you let me know the list of ioctl calls or C functions the tool uses to get the information like the Vendor name, Product name, Target ID, Bus number, LUN, device class .

thanks,
Naveen.