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.
You should follow me on twitter here or grab rss feed to keep track of new changes.
Featured Articles:
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012

- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop












{ 3 comments… read them below or add one }
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).
what is equal tar command for dd if=/device ibs=28800 of=file obs=28800
I use to command status to see default block size
#mt -f /dev/st0 status
…
Tape block size 512 bytes …
…
…