Q. I’ve Debian Linux 4.0 Install on HP Server. This server has SCSI tape device. According to my tape documentation size should be 64k. How can I set the block size for a HP SCSI tape device?
A. You need to use standard tar or cpio command to set the block size for a SCSI tape device. There is no special setting exists to set the block for a tape.
tar command set block size
The -b option use to set block size. The record size of Nx512 bytes (default is N=20). The following example, set a tape to 256k block to backup /data file system:
# tar -b 512 -cvf /dev/st0 /data
To extract simply use:
# tar -b 512 -xvf /dev/st0
- -b 512 Use a blocksize of 512 i.e 512x512bytes
- c : Create archive
- v : Verbose (display progress)
- f : Tape device name /dev/st0
- x : Extract archive
So to set data transfer block size to 64k (64x64bytes), enter:
# tar -b 128 -cvf /dev/st0 /path/to/backup/directory
See more about mt and tar command for making backups under Linux.
Pass the –block-size BLOCK option to cpio command, enter:
# find /home | cpio --block-size 128 -o -H tar -F /dev/nst0
To Restore backup, enter the following command
# cpio --block-size 128 -i -F /dev/nst0
How do I find out tape block size?
Refer to tape manufactures documentation or product web site. However, with the help of dd command (little trial and error) you can find actual blocksize of tape. All you have to do is provide ibs=BLOCKSIZE:
# dd if=/dev/st0 of=/tmp/test.file ibs=64k count=1
dd: reading `/dev/st0': Cannot allocate memory 0+0 records in 0+0 records out
If you get an error message, ‘Cannot allocate memory‘, try next blocksize as selected blocksize (64k) is too small:
# dd if=/dev/st0 of=testfile ibs=256k count=1
1+0 records in 512+0 records out
So 256k is correct block size for this scsi tape device.Share this tutorial on: