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)
--------------enig22B173047CA6F2CE6E1809BA
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....
>=20
> 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=
e
> I need to do it directly by piping the output of the archive extraction=

> to the tar(1) command to write it to tape.
>=20
> I tried this (using a small test archive to prevent disaters):
>=20
> tar xzvf foobar.tgz | tar cvf wibble.tar -
>=20
> which, as I half-expected, didn't work and neither did this:
>=20
> tar xzvf foobar.tgz -C - | tar cvf wibble.tar -
>=20
> tar: could not chdir to '-'
>=20
> 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?
>=20
> 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.

	Cheers,

	Matthew

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


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

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

iD8DBQFFYe2S8Mjk52CukIwRCLT0AJ4gmnc1QBwIkvM7sk7VnDnKF93uUACbB00l
CoYwo1KvnTrvjSk1I07+bG4=
=SHX9
-----END PGP SIGNATURE-----

--------------enig22B173047CA6F2CE6E1809BA--




More information about the Ukfreebsd mailing list