About Linux FAQ

Browse More FAQs:

Linux Set the Block Size for a SCSI Tape Device

Posted by Vivek Gite [Last updated: January 9, 2008]

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
Where,

  • -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.

cpio command

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
Output:

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
Output:

1+0 records in
512+0 records out

So 256k is correct block size for this scsi tape device.

Subscribe to our free e-mail newsletter or RSS feed to get all updates. You can Email this page to a friend.

Related Other Helpful FAQs:

Discussion on This FAQ

  1. flash Says:

    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=256k count=1
    1+0 records in
    512+0 records out

    So 256k is correct block size for this scsi tape device.
    ===============================
    No! 256k is only correct for the tape that was inserted on the drive. The tape device might accept larger block size (2Mb for IBM3592 for example).

Leave a Reply

We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Tags: , , , , , , , , , , , , , , , , , , , , ,

Copyright © 2006-2008 nixCraft. All rights reserved - TOS/Disclaimer - Privacy policy - Sitemap - Powered by Open source software.