Piping output of tar(1) into another tar(1) command

Matthew Seaman m.seaman at infracaninophile.co.uk
Mon Nov 20 18:01:47 GMT 2006

This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
Content-Type: text/plain; charset=ISO-8859-15
Content-Transfer-Encoding: quoted-printable

Mark Ovens wrote:
> I'm sure this is possible, but I can't work it out....
> I have a massive Gzip'd tar archive that I need to put onto tape (DAT)
> as I need the disk space. I don't have enough disk space to extract the=

> archive to a temporary location in order to archive it to tape therefor=
> I need to do it directly by piping the output of the archive extraction=

> to the tar(1) command to write it to tape.
> I tried this (using a small test archive to prevent disaters):
> tar xzvf foobar.tgz | tar cvf wibble.tar -
> which, as I half-expected, didn't work and neither did this:
> tar xzvf foobar.tgz -C - | tar cvf wibble.tar -
> tar: could not chdir to '-'
> I'm sure I've seen this done, but how? Or am I thinking about when
> dump(8) is used, piped into tar(1) to write it to tape?
> Anyone know how to do this?

It's already in tar format, so no need to un-tar it.  Something like this=

    gzcat foobar.tgz | dd bs=3D10k of=3D/dev/nsa0

will write it straight to tape.  Note the 10kB block size shown is very
common with most tape hardware, but YMMV if you have a very weird tape
drive.  You might even get away with entirely the wrong blocksize anyhow.=

After you've written it to tape use:

    mt -f /dev/nsa0 rewind
    tar -tvf /dev/nsa0

to verify that what was written to tape is readable and in good shape.



Dr Matthew J Seaman MA, D.Phil.                       7 Priory Courtyard
                                                      Flat 3
PGP: http://www.infracaninophile.co.uk/pgpkey         Ramsgate
                                                      Kent, CT11 9PW

Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

Version: GnuPG v1.4.5 (FreeBSD)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org



More information about the Ukfreebsd mailing list