List the tape drives installed in solaris
Hi ,
Can some one please let me know how can I display the tape drives which is installed in Solaris (below Version 8)
In solaris 8 we can use cfgadm , However below 8 other than prtconf is there any command or way to findout the devices installed . prtconf and sysdef command outputs are too difficult to digest ,
Thanks
Dileep
[370 byte] By [
Dileep] at [2007-11-25 22:55:28]

# 1
A quick and dirty way would be to do a <b>ls /dev/rmt/?</b>
# 2
Yes I can see the following things .
I would like to use a command which will list all the devices installed in a user friendly manner .
root on LIVE netra1 # ls -l *hbn
lrwxrwxrwx1 rootother 52 Jul 3 1998 0hbn -> ../../devices/<a href="mailto:sbus@3" target="_blank">sbus@3</a>,0/SUNW,<a href="mailto:fas@0" target="_blank">fas@0</a>,8800000/<a href="mailto:st@4" target="_blank">st@4</a>,0:hbn
lrwxrwxrwx1 rootother 50 Jul 3 1998 1hbn -> ../../devices/<a href="mailto:sbus@a" target="_blank">sbus@a</a>,0/QLGC,<a href="mailto:isp@2" target="_blank">isp@2</a>,10000/<a href="mailto:st@1" target="_blank">st@1</a>,0:hbn
lrwxrwxrwx1 rootother 50 Jul 3 1998 2hbn -> ../../devices/<a href="mailto:sbus@a" target="_blank">sbus@a</a>,0/QLGC,<a href="mailto:isp@2" target="_blank">isp@2</a>,10000/<a href="mailto:st@2" target="_blank">st@2</a>,0:hbn
lrwxrwxrwx1 rootother 50 Jul 3 1998 3hbn -> ../../devices/<a href="mailto:sbus@a" target="_blank">sbus@a</a>,0/QLGC,<a href="mailto:isp@2" target="_blank">isp@2</a>,10000/<a href="mailto:st@3" target="_blank">st@3</a>,0:hbn
lrwxrwxrwx1 rootother 50 Jul 3 1998 4hbn -> ../../devices/<a href="mailto:sbus@a" target="_blank">sbus@a</a>,0/QLGC,<a href="mailto:isp@2" target="_blank">isp@2</a>,10000/<a href="mailto:st@4" target="_blank">st@4</a>,0:hbn
Thanks
Dileep
# 3
Depending upon how you want the info to be displayed, try something like:
echo "=== tape drive list ==="
for tape_drive in `ls -1 /dev/rmt/?`
do
echo $tape_drive
done
echo "=== end list ==="
If you want to get any fancier, you could include other stuff inside (and outside) the loop, such as mt -f commands, parsing the output of an iostat -E command to get more details of drive type, etc.
# 4
Hello Simon ,
Thanks very much for the reply ,
ls -1 /dev/rmt/? will display the rmt0 only , Could you please tell me how do I know how many drives are installed if I have multiple drives .
like this I am accessing a remote server I dont know what are the drives installed and I want to know how many is there . iostat in some solaris version its displaying the tape drives in other it doesn't
Thanks
Dileep
# 5
You will see multiple /dev/rmt/<drivenumber>? type files: such as 0, 0n, 0mnb, 0nb, etc., etc. Each of those is a single, physical, tape device but with different logical attributes - the n means the no-rewind device for example.
The usage of just ls -1 /dev/rmt/? was suggested (assuming that none of your systems has a /dev/rmt/10 (or above)) to ensure you just get back one line per device.
iostat will, I believe, show the devices (as st?) or as rmt/? (if you use the -n option).
Ultimately it will be up to you to decide which comand you feel happiest with.
# 6
Dunno exactly what you are after, but a few minutes tapping at a keyboard produced the attached little script. Standard caveats about use etc., apply - it works for me on our Solaris 8 systems, and hopefully it will work for others.
# 7
Did that file get attached? I don't seem to be able to see it ...Hopefully it is now?
# 8
Hello Simon ,
I am not able to execute that script ,because i couldn't see the given options for ioststat
root on LIVE junior # uname -a
SunOS phys-mwm2 5.5.1 Generic_103640-33 sun4u sparc SUNW,Ultra-Enterprise
root on LIVE junior # iostat -e | grep "^st" | nawk '{print $1}'
Usage: iostat [-tdDxcI] [-l n] [disk ...] [interval [count]]
Many Thanks
Dileep
# 9
Looks like the -e option is an addition that exists in Solaris 8, but not in some earlier versions. I am sure that one of the other parameters will get what is needed by my script in that place (and what is needed is output of one device per line, with a recognisable - and unique - identifier saying "this is a tape device").
What you should do (and this is todays homework ...) is to try out a few iostat commands to see which parameter works best for producing the list, then modifying the line in the script to use it and also modifying the grep and nawk commands to process the new output.
# 10
Hi,U can use cfgadm -al command to list the scsi tape driver attached to the system.Naran_rama
# 11
Naran,
If I recall correctly, the cfgadm command is missing from Solaris 2.5.1
They'd need a much newer Solaris to get that added feature.
Standard OS commands are all that they would have available.
Since all they found in the directory listings were references to a #0 drive, then that would suggest one mechanism and it appears to be a tape library.