Linux tar: /dev/st0: Cannot write: Invalid argument error and solution

by on June 5, 2008 · 1 comment· LAST UPDATED May 29, 2008

in , ,

Q. When I run tar command it fails with an error that read as follows:

tar: /dev/st0: Cannot write: Invalid argument

How do I fix this error under CentOS / Debian / Fedora / RHEL Linux HP server systems?

A. You need to specify the block factor size. If you try to write a large file on tape this error may occur.

The data in an archive is grouped into blocks, which are 512 bytes. Blocks are read and written in whole number multiples called records. The number of blocks in a record (i.e., the size of a record in units of 512 bytes) is called the blocking factor.

Archives with blocking factors larger than 20 cannot be read by very old versions of tar, or by some newer versions of tar running on old machines with small address spaces. With GNU tar, the blocking factor of an archive is limited only by the maximum record size of the device containing the archive, or by the amount of available virtual memory.

How do I fix this error?

Set blocking factor to 256 to avoid this error with the -b option. For example, use the following command to backup the /webroot directory and its content to /dev/st0 with 256 blocking factor:
# tar cvf -b 256 /dev/st0 /webroot

TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 1 comment… read it below or add one }

1 nery gurl January 11, 2010 at 5:03 pm

hi! I just want to ask how could I restore Linux OS to my netbook. I encountered a problem when I change my OS to WXP (NTLDR error) so I try to recover it back to linux but then when Im trying to do it has an error “invalid argument” I hope that you would somehow help me solve my problem.

Reply

Leave a Comment

Tagged as: , , , , , , , , , , , , , , , ,

Previous Faq:

Next Faq: