On Wednesday 29 December 2010 18:41:00 Alex Schuster wrote:
> Peter Humphrey writes:
> > On Wednesday 29 December 2010 17:50:08 Alex Schuster wrote:
> > > What Maciej said. Or, for greater security when the destination is
> > > outside the LAN:
> > > 
> > > cd [source] & tar xpf - . | ssh [us...@[host] 'cd [dest] && tar xpf
> > > -'
> > 
> > That's what I was looking for - a single command I can run on the source
> > machine. Thanks Alex.
> > 
> > Just one more thing - what if I only want to store the tar of the source
> > directory as an archive on the remote machine? In that case I'd want to
> > stream the incoming data into a file instead of untarring it.
> 
> Replace the tar by cat, and redirect into a file:
> 
> cd [source] & tar xpf - . | ssh [us...@[host] 'cat > [dest]/[name].tar'

The front part should be tar -cpf not -xpf?

Also, option -S manages sparse files more efficiently.

Finally, if it is a large archive and is going to travel over a slow network 
it would make sense to compress it first locally into a tar file (e.g. using -
j) then verify it (if it is important data that you rely on just add -W) and 
finally ssh the compressed tar file over.

If you are going to use pipes, then dd will also work instead of cat; i.e.

 cd [source] & tar cpvSf - . | ssh [us...@[host] "dd 
of=/backup_storage/mydata.tar.bz2"

I don't think that dd is any different to cat in performance terms (but 
haven't tested it).
-- 
Regards,
Mick

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to