10
3
I am trying to get a handle on how to pipe from a command into something like gzip, cpio or tar.
The commands in question belong to the ZFS system. I am running ZFS on Ubuntu Linux 10.04.3.
The commands I working with are;
To create a snapshot;
zfs snapshot media/mypictures@20070607
To copy the snapshot to a directory;
zfs send media/mypictures@20070607 > ~/backups/20070607
Then I can also pipe into gzip
zfs send media/mypictures@20070607 | gzip > ~/backups/20070607.gz
These parts I understand.
But my first question is, what would I do to pipe into tar + gzip?
This?
zfs send media/mypictures@20070607 | tar czvf > ~/backups/20070607.tar.gz
And my other question is how would I get the data out of the tarball or gzip?
I have to use zfs recieve media/mypictures@20070607 < ~/backups/20070607
So would it just be this if I was using tar?
zfs recieve media/mypictures@20070607 | tar xzvf < ~/backups/20070607.tar.gz
Any idea?
2Tar DOES NOT expect a list of file names unless you specify the
-f
option (tar also acceptsf
without the "-"). – drevicko – 2016-02-02T15:55:50.8431@drevicko: The context of the question is creating a tar archive. The list of files I mean is the list of files (and/or directories) to be included in the written archive. For example:
cd /etc; TAPE=/tmp/rgb.tar tar c hosts passwd
where the list of files ishosts passwd
– RedGrittyBrick – 2016-02-02T16:38:59.3602@RedGrittyBrick but the context of the question is to tar from a pipe, ie: no list of files. Saying tar expects a list of files is not true. The problem is that it expects a (single) output file name when the OP specifies
f
, and he didn't provide it. – drevicko – 2016-02-02T17:02:53.000Really? I though tar was just another form of compression. So skip tar and just gzip? – ianc1215 – 2011-09-22T17:59:56.553
3Yes, just use
zfs send media/mypictures@20070607 | gzip -c > ~/backups/20070607.gz
– RedGrittyBrick – 2011-09-22T19:01:14.567