1833759 Members
2471 Online
110063 Solutions
New Discussion

tape's record size

 
SOLVED
Go to solution
Ed Daraki_2
Occasional Advisor

tape's record size

Hi,

I am porting a tape program from Solaris to HP-UX. My question is about setting the record size. I need to write to tapes in a way that other systems can read it with 32k record size. In Solaris there is MTSRSZ command from mtio that does the job. As I understand there is no equivalent for MTSRSZ in HP-UX and the record (or block) size is encoded in the tape device file name. So on my machine I had to get the administrator to create a device file for tape like this:
/dev/rmt/c3t14d0s32768BEST
Is there any other way to set the record size dynamically through my program? Is there any standard short name for this new device file?

Thanks in advance for any reply!

8 REPLIES 8
harry d brown jr
Honored Contributor

Re: tape's record size

Ed,

The MAXIMUM tape block size is limited by the tapedrive.

live free or die
harry
Live Free or Die
Ed Daraki_2
Occasional Advisor

Re: tape's record size

Harry,

My question is not about the Maximum block size.
The question is about the way to do it. In HP-UX scsi tape drives by default work in variable block size mode. If you want to have fixed block size you have to set it some where. In HP-UX the block size can be encoded in the device name. You can use SAM or mkfs to create a new tape device file for a scsi drive under /dev/rmt and choose it to work with fixed record length. This will show up as a letter "s" and then the block size in the device file name. This is what I have done already and works ok.

My question is how to do the same thing dynamically in my program, as you can do in other Unix flavors (Solaris, AIX and Linux). It seems to me that it is not possible in HP-UX. Can anybody confirm?

Carlos Fernandez Riera
Honored Contributor

Re: tape's record size

I have used special densities few times... and it was to read old tapes that had a Phsysical record size of 512 instead 1024 bytes ( they were DAT/DDS tapes tape/drives).

Also to write DDS format on 512 bytes to be read on old tapes whit DDS2 tape drivers.

This is: one thing is what you send to driver ( special file) and other thing is how the type driver must write/read it.

You can see /usr/inlcude/sys/mtio.h to know what arguments are recogniced by ioctl.

mtio is a generic driver for tapes.

Note that there are a new patch to that implement DDS3 and DDS4 densities for tape drivers.

HTH.
unsupported
MANOJ SRIVASTAVA
Honored Contributor

Re: tape's record size

Hi Ed


What is the utility you ar using in the script to write on the tape , is it tar or cpio ,or dd ?


Manoj Srivastava
John Palmer
Honored Contributor

Re: tape's record size

Ed,

It must be possible because utilities like dd are able to write blocks of a specific size e.g. bs=64k.

I suspect that you have to use tape specific calls to ioctl - see man 7 scsi_tape for more information.

Regards,
John
Ed Daraki_2
Occasional Advisor

Re: tape's record size

Calos, Manoj, John,

I am already using mtio and ioctl calls, but the problem is: there is no block size setting option there (similar to MTSRSZ in Solaris). Please read my quetion.

Carlos, Density is a different parameter from block size.

Manoj, I use a program written in C++ to access the tape. I am not using any scripts.

John Palmer
Honored Contributor
Solution

Re: tape's record size

Ed,

Have you read the man page for scsi_tape?

Quote:
SCSI sequential-access (tape) devices store a sequence of data blocks.
Data can be read and written using either fixed or variable sized
block mode. If supported by the device, variable sized block mode is
normally used (even when all blocks are the same size). Fixed sized
block mode is generally only used for tape devices which do not
support variable sized blocks.
End quote.

Is your application not able to write 32k blocks? If it does then the contents of the tape would be the same as if the driver does it.

The man page goes on to state:
The SIOC_SET_BLOCK_SIZE ioctl changes the current block size to the
specified number of bytes. Setting the block size to zero specifies
that variable-sized-block mode should be used. Any non-zero block
size specifies that fixed-sized-block mode should be used. By
default, the device driver attempts to set the block size to zero
during open. If variable-sized-block mode is not supported by the
device, the driver selects an appropriate block size for fixed-sized-
block mode use. Note that the device block size set by the
SIOC_SET_BLOCK_SIZE ioctl survives between close() and open() calls,
but not through system reboot.

Which indicates that you can force the driver to 'fixed length block mode'.

Regards,
John

PS I did read your question!
Ed Daraki_2
Occasional Advisor

Re: tape's record size

Thanks John!
You were 100% right, The SIOC_SET_BLOCK_SIZE ioctl did the job!

I was thinking that the solution is in mtio and a MTIOCTOP ioctl call (similar to Solaris and Linux), but I was wrong.

Thanks again.