Matt Shields mshields at
Thu Aug 24 08:08:33 EDT 2006

You can also use rsync with ssh.  To push files use:
rsync -rpte ssh /my/local/path server:/my/remote/path

If you want your server to pull the files, just reverse the
/my/local/path and server:/my/remote/path

Matthew Shields
Sr Systems Administrator
NameMedia, Inc.
(P) 781-839-2828
mshields at
-----Original Message-----
From: discuss-bounces at [mailto:discuss-bounces at] On Behalf
Of Matthew Gillen
Sent: Wednesday, August 23, 2006 9:30 PM
To: Chris OConnell
Cc: Blu
Subject: Re: Backups

Chris OConnell wrote:
> Hi Guys,
> I've pretty much switched to Suse entirely, but am unable to figure
> how to perform a backup.  I assume there must be a CP parameter that
> will say "copy everything in this directory recursively (hidden files
> too) and verify them for size when you are done."
> Does anyone use a script or program they like or would be willing to
> share to backup their files to a removeable drive?

If you must use 'cp', then make sure to use 'cp -a' so that it handles
things like symlinks or device files correctly.  For some *nix foo,
learn to
use 'tar'.  As someone else mentioned, rsync can be used to do efficient
updates to an existing backup.

Here's what I do for large directories (if step 1 doesn't take long,
just use it and don't bother with step 2):
1) use tar for the the initial backup.  Assuming your files are in
/opt/somedir and you want to copy them into /backup/somedir :
 cd /opt ; tar -cvf - somedir | tar -C /backup -xf -

This copies the directory with all the advantages of using tar over cp,
without creating the intermediate .tar file.

Why do this instead of 'cp'?  Because you can use a slight modification
backup to remote hosts via ssh:
 cd /opt ; tar -cvf - somedir | ssh -C remotehost tar -C /backup -xf -

Pipes are fun ;-)  Pipes with ssh let you do some really whacky things.

2) for updates, or to verify that the copy is complete, use rsync:
 rsync -avz --delete /opt/somedir /backup/

Note that rsync is picky about the trailing slash on the "source"
and you may or may not want the --delete option (removes files in
/backup/somedir that are no longer in /somedir).   As the man page for
says: be very careful when using --delete about not getting the 'src'
'dest' mixed up.  When using rsync from the command line, I always
check the man page to make sure I have the arguments in the right order.


This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

Discuss mailing list
Discuss at

This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

More information about the Discuss mailing list