Operating System - HP-UX
1826716 Members
2783 Online
109702 Solutions
New Discussion

Re: how to get device path

 
manasa_1
Occasional Contributor

how to get device path

Hello,
This is the section of code in tru64 to get the respective device path.
dev_name=$(hwmgr -view devices |grep DVD-ROM |awk '{print $2}')

how can i do it in hp-ux. i believe we need to use ioscan for this.but still i am not familiar with it.
10 REPLIES 10
Jeeshan
Honored Contributor

Re: how to get device path

If you want to see your DVD hardware path
issue this command

#ioscan -fnC disk|grep DVD
a warrior never quits
Davis Paul
Valued Contributor

Re: how to get device path

Hi Manasa,
#Ioscan -fn command output will give all Hardware installed in the system. For more details refer the man page of ioscan.

Regards,
Davis Paul
Sajjad Sahir
Honored Contributor

Re: how to get device path

if u want to see a list of hardware attache to your system before adding or deleting any device u can use ioscan command
for example
i added a disk from eva
now i want to see to
i can use ioscan -funC disk(here disk is a category
it will show claimed or not
once it is claimed it means it is loaded in the kernal
ohterwise u have to create device files
by using insf -e or insf -e disk
ok

Sajjad Sahir
Honored Contributor

Re: how to get device path

one more thing once u added a disk u have to use insf -e otherwise it will not claim
normally u can use ioscan -funC disk
then it will show all hardware path,class,driver etc...
Venkatesh BL
Honored Contributor

Re: how to get device path

In tru64, this would get the absolute file pathname of the given device.

Ex: /dev/disk/floppy0c (for a floppy)

In hpux, the ioscan output displays the path, but not on the same line.

Ex:


disk 3 0/0/2/1.3.0 sdisk CLAIMED DEVICE HP DVD-ROM 305
/dev/dsk/c1t3d0 /dev/rdsk/c1t3d0

Here the device path name comes in the line after the 'DVD' string. So, I think you may have to do some extra filtering to get the pathname correctly.

I am not aware of any ioscan option that displays it the tru64 way.
Sajjad Sahir
Honored Contributor

Re: how to get device path

manasa u have to assiang points to the peoples
Shrikant Lavhate
Esteemed Contributor

Re: how to get device path

Hi,

For getting hardware path of DVD you can use ioscan.

The third field in ioscan output is hardware path which you can extract using normal awk thing. Try:
#ioscan -fnC disk|grep -i DVD|awk '{print $3}'
Will it remain a personal, if I broadcast it here!
Bill Hassell
Honored Contributor

Re: how to get device path

ioscan will (by default) query every driver in the system for every possible hardware device (which means slow). Always use the -k option for ioscan for instant response. Drop the -k when you add or delete devices without rebooting (advisable only with hotswap hardware).

The DVD may or may not have a SCSI ID string that says DVD since this string is provided from the drive manufacturer. You can limit the output to just disks with this command:

ioscan -kfC disk

Once you see the ID for the DVD, you can narrow the search using grep to match the string. If this is part of a general script to look at many machines, grep'ing for DVD will eventually overlook some devices because of their ID string. Try something like this:

ioscan -kfC disk | grep -ie dvd -e cd -e rom

That should get most all CD/DVD drives.


Bill Hassell, sysadmin
WWarren
Advisor

Re: how to get device path

While the above answers are standard and can be found in the HP-UX FAQs, they are unsatisfying. Why? Because you are making assumptions about the ioscan output which may or may not be valid - you are at the mercy of whatever description the manufacturer puts there.

For example, I have an rx2600 with a DVD drive for which ioscan gives the output 'TEAC DV-28E-N'. Neither 'CD' nor 'DVD' nor 'ROM' are in the string. [And someday soon (maybe already?) there will be Blu-ray.]

There ought to be a better way to tell when scripting whether the sdisk device is a CD/DVD-type removable media disk or a 'regular' disk. Anybody have one?
Torsten.
Acclaimed Contributor

Re: how to get device path

Well, as mentioned before, you cannot assume "DVD" or "CD_ROM" or anything in the name.

How about this?

This is an USB DVD drive in 11.31:

disk 7 0/0/2/1.0.16 UsbScsiAdaptor CLAIMED DEVICE USB SCSI Stack Adaptor
/dev/deviceFileSystem/Usb/MassStorage/dsk/disk@hp-1008+294=A60020000001
/dev/deviceFileSystem/Usb/MassStorage/rdsk/disk@hp-1008+294=A60020000001




But if I test my CD/DVD drive I get

# diskinfo /dev/rdsk/c1t2d0 | grep type
type: CD-ROM

for the disk I get

type: direct access

But do I really need a script for this?


Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!