Gentoo Archives: gentoo-user

From: Mick <michaelkintzios@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Best way to copy /* ?
Date: Wed, 29 Dec 2010 19:17:47
Message-Id: 201012291916.17450.michaelkintzios@gmail.com
In Reply to: Re: [gentoo-user] Best way to copy /* ? by Alex Schuster
1 On Wednesday 29 December 2010 18:41:00 Alex Schuster wrote:
2 > Peter Humphrey writes:
3 > > On Wednesday 29 December 2010 17:50:08 Alex Schuster wrote:
4 > > > What Maciej said. Or, for greater security when the destination is
5 > > > outside the LAN:
6 > > >
7 > > > cd [source] & tar xpf - . | ssh [user]@[host] 'cd [dest] && tar xpf
8 > > > -'
9 > >
10 > > That's what I was looking for - a single command I can run on the source
11 > > machine. Thanks Alex.
12 > >
13 > > Just one more thing - what if I only want to store the tar of the source
14 > > directory as an archive on the remote machine? In that case I'd want to
15 > > stream the incoming data into a file instead of untarring it.
16 >
17 > Replace the tar by cat, and redirect into a file:
18 >
19 > cd [source] & tar xpf - . | ssh [user]@[host] 'cat > [dest]/[name].tar'
20
21 The front part should be tar -cpf not -xpf?
22
23 Also, option -S manages sparse files more efficiently.
24
25 Finally, if it is a large archive and is going to travel over a slow network
26 it would make sense to compress it first locally into a tar file (e.g. using -
27 j) then verify it (if it is important data that you rely on just add -W) and
28 finally ssh the compressed tar file over.
29
30 If you are going to use pipes, then dd will also work instead of cat; i.e.
31
32 cd [source] & tar cpvSf - . | ssh [user]@[host] "dd
33 of=/backup_storage/mydata.tar.bz2"
34
35 I don't think that dd is any different to cat in performance terms (but
36 haven't tested it).
37 --
38 Regards,
39 Mick

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-user] Best way to copy /* ? "Stefan G. Weichinger" <lists@×××××.at>