Backing up multiple user data
Janina Sajka
janina at rednote.net
Wed Sep 29 21:14:21 EDT 2004
And this from Linux Server Hacks also available at BookShare:
Linux Server Hacks (p44 of 115)
37) Backing Up with tar over ssh
Copy arbitrary bits of the filesystem between servers using ssh and
tar
Shuffling files between servers is simple with scp :
root at inky:~#
scp some-archive.tgz blinky:/
Or even copying many files at once:
root at pinky:~/tmp#
scp clyde:/usr/local/etc/* .
But scp isn't designed to traverse subdirectories and preserve
ownership and permissions. Fortunately, tar is one of the very early
(and IMHO, most
brilliant) design decisions in ssh to make it behave exactly
as any other standard Unix command. When it is used to execute commands
without an
interactive login session, ssh simply accepts data on STDIN and
prints the results to STDOUT. Think of any pipeline involving ssh as an
easy portal to
the machine you're connecting to. For example, suppose you want to
backup all of the home directories on one server to an archive on
another:
root at inky~#
tar zcvf - /home | ssh pinky "cat > inky-homes.tgz"
More information about the Speakup
mailing list