Operating System - HP-UX
1753969 Members
7227 Online
108811 Solutions
New Discussion юеВ

Re: best way to identify tape device attributes in a script

 
SOLVED
Go to solution
Roger May_1
Occasional Contributor

best way to identify tape device attributes in a script


We have a script that we use to create a bootable/installable Ignite-UX DAT tape. We need the ability to properly check for the "norewind" option in the script.

Is there a way to use the major/minor number info to determine if a user entry (manually typed in) is for a tape device file that uses the "norewind" option?

We do not want to rely on the last character of the device file as the indicator (all the device files we have that are norewind have an "n" as the last character).

We prefer using the information contained within the major/minor number fields of an ls-al output.

So, for example, in the list below, how do we decode the info for the c3td0BESTn device file (205 0x033040), or the 3mn device file (205 0x0230c3) to be sure it is a "norewind" device file? What in the info shows that the device file is "norewind", or that it is Berkeley...?

# pwd
/dev/rmt
# ls -al
crw-rw-rw- 1 root root 205 0x023084 Apr 1 16:06 3c
crw-rw-rw- 1 root root 205 0x0230c4 Apr 1 16:06 3cn
crw-rw-rw- 1 root root 205 0x023083 Apr 1 16:06 3m
crw-rw-rw- 1 root root 205 0x0230c3 Apr 1 16:06 3mn
crw-rw-rw- 1 bin bin 205 0x033000 Mar 20 08:42 c3t3d0BEST
crw-rw-rw- 1 bin bin 205 0x033080 Mar 20 08:42 c3t3d0BESTb
crw-rw-rw- 1 bin bin 205 0x033040 Mar 28 15:15 c3t3d0BESTn
crw-rw-rw- 1 bin bin 205 0x0330c0 Mar 20 08:42 c3t3d0BESTnb
7 REPLIES 7
Paula J Frazer-Campbell
Honored Contributor

Re: best way to identify tape device attributes in a script

Hi Roger

Two Points.


1. Why no rewind on a ignite tape - tapes are cheap - one make recovery / tape.

2. Why user input on device file? - users will mess thing up - just script the correct device file - test it and it will not go wrong.


Paula
If you can spell SysAdmin then you is one - anon
Paula J Frazer-Campbell
Honored Contributor

Re: best way to identify tape device attributes in a script

Roger

Thanks for the point, but are there reasons as to why you are seeking this solution?

The more info the forum has the better we can help.




Paula
If you can spell SysAdmin then you is one - anon
Paula J Frazer-Campbell
Honored Contributor
Solution

Re: best way to identify tape device attributes in a script

Roger


See man lssf on device file listing.

sysadmin@N-0/>lssf /dev/rmt/0m


stape card instance 3 SCSI target 3 SCSI LUN 0 at&t best density available at address 1/2/0/0.3.0 /dev/rmt/0m


Paula
If you can spell SysAdmin then you is one - anon
Carlos Fernandez Riera
Honored Contributor

Re: best way to identify tape device attributes in a script

lssf /dev/rmt/1mn

stape card instance 0 SCSI target 3 SCSI LUN 0 at&t no rewind best density available at address 0/0/1/0.3.0 /dev/rmt/1mn


lssf /dev/rmt/1m

stape card instance 0 SCSI target 3 SCSI LUN 0 at&t best density available at address 0/0/1/0.3.0 /dev/rmt/1m

Then:

CANREW=`lssf $tape | grep -c "rewind"`

unsupported
Bill Hassell
Honored Contributor

Re: best way to identify tape device attributes in a script

As mentioned, using lssf is the preferred (and most reliable) method. The minor number contains the bit that defines no-rewind behavior but this bit does not have a secure place...it may be a different bit for a different driver (major number). Only lssf can obtain all the codes for all the drivers correctly.

Note also that no-rewind implies specific tape positioning and the default AT&T behavior for no-rewind can best be described as bizarre. If you must position the tape to an exact location, always use the Berkeley device files with no-rewind. The info is in: man 1 mt and more details are found in: man 7 mt, specifically the Tape Behavioral Characteristics section.

Berkeley device files can be created with insf or mksf if needed.


Bill Hassell, sysadmin
Roger May_1
Occasional Contributor

Re: best way to identify tape device attributes in a script

Thanks for the help.

I couldn't remember the 'lssf' command!

FYI: The "no rewind" option is needed when creating a bootable/installable DAT tape, so that when 'dd'ng the bootlif file to tape at 2k block size, the tape doesn't rewind before 'dd'ng the golden image file to tape (10k block size)

We have more than one DDS tape drive attached to some workstations, so it is necessary to check the user entry for the tape device they want to use when creating the boot/install tape. It is not common to use a "no rewind" tape device, so that is why we need to check the user's entry.
Paula J Frazer-Campbell
Honored Contributor

Re: best way to identify tape device attributes in a script

Hi Roger

Make_tape_recovery does what you are doing by default and creates a bootable tape.

Command for full vg00 Mkae recovery.

/opt/ignite/bin/make_tape_recovery -x inc_entire=vg00 -I -v -a /dev/rmt/0mn

HTH

Paula


If you can spell SysAdmin then you is one - anon