/dev/dat/vdat010 (internal DAT),
/dev/cgmt/vcgmt160 (cartridge magnetic tape),
/dev/omt/vomt055 (open reel magnetic tape)
To install a variable-length blocked device, the file name must first be created.
The super user then executes the following command:
/etc/mknod /dev/dat/vdat010 c 119 0x010001 /bin/chmod 0666 /dev/dat/vdat010 |
Blocks of any lengths can be written on variable-length blocked tape.
Because blocks of any lengths can be written, this type of tape can directly handle data in binary format, in addition to data in DAT format. The tape must be read in blocks the same length as they were written (for example, if a block written in 64 KB is read in 32 KB, the remaining 32 KB are discarded). Because there is no means of communicating to a reader that the record length changes, all blocks except the last block are normally written at the same length, and only the last block is written as a fractional block length.
Because the database load utility (pdload) makes that last block 32 KB, tapes with block lengths longer than 32 KB cannot be read correctly.
When a file is created, the block length should be 32 KB or less.
In the following example, the block length is set at 32 KB when the file is created.
The file is created in the same way in DAT format and binary format.
Because the cp command cannot set the buffer length, it cannot be used; the dd command must be used instead.
dd if=/usr/bin/vi of=/dev/dat/vdat010 bs=32k![]() ![]() |
System output
When the following types of programs are created, data of any length (specified by data_len) is output to variable-length blocked tape in 32-KB blocks. This is done by allocating the 32-KB write_buf to the system buffer and specifying full buffering (_IOFBF).
#define PROC_BUFSIZ 1024 * 32 FILE* fp; int data_len; /* data length (needed in binary format) */ char write_buf[PROC_BUFSIZ]; /* buf system call */ char data_buf[PROC_BUFSIZ]; /* buf user */ : fp = fopen("/dev/dat/vdat010","w") setvbuf(fp, write_buf, _IOFBF, PROC_BUFSIZ) : while(while there is data) { data write processing } : fclose(fp); |
If the original data was in a regular file, it must be reloaded using the method in (a).
When there are two DAT devices, the buffer length can be converted with the following method:
dd if=/dev/vdat010 ibs=64k of=/dev/vdat011 obs=32k |