Using rsync to mirror a hard drive.

Thaddeus L. Olczyk olczyk at
Tue Oct 23 03:37:51 EST 2001

On Mon, 22 Oct 2001 11:12:41 -0500, Dave Dykstra <dwd at>

>On Mon, Oct 22, 2001 at 01:18:47AM +0000, Thaddeus L. Olczyk wrote:
>> 5) I need to know if rsync fails. It is useless to me if it fails 
>> and then fails to notify me. The man pages fail to totally describe
>> return values, but I assume that they do describe success/failure.
>> So I wrote a script to test this out.
>> #!/bin/sh
>> export res=$(rsync -avv / /mirror)
>> echo $(res)
>I don't understand that syntax.  /bin/sh for me reports
>    syntax error: `(' unexpected
>Under ksh I would expect that to be equivalent $(...) to be equivalent
>to `...` but then what would echo `res` mean?
The second line should read
echo $res.
This is being executed under bash ( so it may be a newer feature, I'm
not sure because I used csh before bash ).
The first line executes the command: rsync -avv  /  /mirror
and stores the retunr value in res.
The second command ( was supposed to ) print the return value of the
rsync command.

>> I then mounted a partition of 15M on /mirror, and executed the script
>> to get an idea of how rsync behaved when it ran out space.
>> rsync seems to hang in the middle of /etc .
>> df shows that only 75% of /mirror is filled/
>> Any idea why rsync hangs.
>Perhaps it's a problem with your script?
I should say that I've run it from the command line, from the
command-line with strace ( traces system calls ), ltrace ( traces
library calls ) and from within emacs. In each case it hangs.

>Rsync excludes are not as powerful as regular expressions.  However, if
>you start them with a slash, they match only the beginning of a path.
>So you should be able to just say "/proc", "/mirror", "/tmp", etc.
One of the problems that I get ( which I'm not yet seriously tackling
until the hanging problem is solved ) is that rsync complains that
it can't open a whole set of files /proc/xxx . Which in some sense
is OK since find does the same thing, but I've tried various form
of excludes:
rsync -avv --exclude=/proc /  /mirror
rsync -avv --exclude=/proc/ /  /mirror
rsync -avv --exclude="/proc" /  /mirror
rsync -avv --exclude="/proc/" /  /mirror
rsync -avv --exclude=proc/ /  /mirror
rsync -avv --exclude="proc/" /  /mirror
and they all generate the errors about reading files of type /proc/xxx

More information about the rsync mailing list