Wondering how to resolve the error ‘tar /dev/st0 cannot write invalid argument’? We can help you in resolving it.
Recently, one of our customers approached us saying that he came across the error message “tar /dev/st0 cannot write invalid argument” while trying to take a backup using the tar command.
This error can occur while trying to write a large file on tape.
Here at Bobcares, we have seen several such command-related errors as part of our Server Management Services for web hosts and online service providers.
Today we’ll see the cause for this error message. Also, let us see how to fix it.
How we resolve the ‘tar /dev/st0 cannot write invalid argument’ error
As mentioned earlier, our customer ran the below command to take backup using the tar command.
# tar -cvf /dev/st0 /<directory>
As a result, he came across the below error message.
tar: /dev/st0: Cannot write: Invalid argument tar: Error is not recoverable: exiting now.
While trying to write a large file on tape, this error can occur.
Here, the data in an archive is grouped into blocks, which are 512 bytes. The 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.
Very old versions of tar cannot read the archives with blocking factors larger than. Or some newer versions of tar running on old machines with small address spaces also can’t read them. 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.
Now let’s take a look at how our Support Engineers resolve this error message.
Here, we need to specify the block factor size.
So, we set the blocking factor to 256 to avoid this error with the -b option. For example, use the following command to back up the /webroot directory and its content to /dev/st0 with 256 blocking factor:
# tar cvf -b 256 /dev/st0 /webroot
[Need any further assistance with Linux command errors? – We are here to help you.]
In today’s writeup, we saw how our Support Engineers resolve this error relating to Linux commands.