Search code examples
unixtarscpcorruptmd5sum

copying .tar.gz file while writing it


Is writing a .tar.gz file purely sequential?

When copying a large file, I started compressing it, and while it was compressing, scping it to a different machine. Afterwards I checked the md5sum on both machines, and they did not match. I guess it wasn't the best idea ever to start reading the .tar.gz before it was finished. I supposed that writing that .tar.gz file would only append to the end so that reading it would work out fine.

Does anybody know anything about the mechanics of this? What specifically is happening here?


Solution

  • If you were doing to scp with a simple .tar file, it could work.

    tar is a sequential archiving tool mostly designed to be piped to cpio to write on a tape.

    But here, you ask tar to first create the archive and then compress it. The compression can happen only after the archive is finished.