-   Linux - General (
-   -   Is Tar file to tape drive faster than dir/files to tape drive? (

Runge_Kutta 03-09-2009 07:54 PM

Is Tar file to tape drive faster than dir/files to tape drive?
I have about a 163GB tar file that contains a backup project. I will be putting this file onto SDLT1 tape using compatible drive (compression is confirmed to be on). My question is this:

will the transfer to the tape drive go faster if I use the tar file or the original directories and files:

dd if=project.tar.gz of=/dev/st0 bs=16k


tar -cvzf /dev/st0 /project

will any combination of bit sizes, options, or compressions make one method faster than the other? Or is the dd command going to be the fastest for my situation?

Also, my problem with using the dd command is that it is going to limit my ability to check the files on the tape after data transfer is finished as supposed to using a straight tar command: i.e. tar -tvzf /dev/st0 would not be possible after using the dd command above without first copying entire file to disk before running tar -tvzf on copied tar file. Or is there a way around this?

GazL 03-10-2009 07:59 AM

There is a way around it, to write on the fly you can use the '-' stdin/stdout as the filename on tar.


tar -cvzf - /project | dd bs=16k of=/dev/st0
and similar to test.


dd bs=16k if=/dev/st0 | tar -tvzf -
Whether this would be faster or not would probably depend on the specifics of your tape device, and how the linux driver interacts with it. I've certainly used the above approach on commercial UNIXs before to good effect but I've no experience with tape on linux.

If your tape drive does it's own hardware compression, then you might be better off not using the -z tar option. It'll just use up cpu time for no gain (in some cases, compressing compressed data can actually make the data larger).

You could always do a couple of benchmarks on a subset of your data, trying a few different blocksizes/compression options and come back and let us know if it has an effect. :)

choogendyk 03-11-2009 08:13 AM

If you are planning on going to tape in the first place, then it would be faster (from the beginning) to just go straight to tape with tar, and skip the gzip as well as the -z option on tar. You confirmed compression is on for the tape drive.

Of course, this is assuming you have no reason to have the tar file sitting around on your system (not on tape). The time spent doing the tar and the gzip then was wasted time, which you wouldn't do in the future. The gzip on something that large takes a long time, and then, if compression is on for the tape drive, it actually slows it down a bit as well as possibly losing some space.

With gnu tar, you can mess around with record sizes for tape, but I've never done that. I use Amanda for my tape backups. You could check the man page or the documentation at You can also get information from gnu tar on the format (including blocking factor) of an existing archive.

All times are GMT -5. The time now is 08:37 AM.