Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am using rsync for backup about 100GB files and directories. My command is

sudo rsync -azvv /home/path/folder1/ /home/path/folder2

However, the output for each file goes up so quickly and there are so many files, that I worry if there are some errors I cannot catch. So I wonder how you would catch any errors during backup?

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

Redirect the error stream to a file that you can read later. The verbose output goes to standard output whereas errors go on standard error.

sudo rsync -azvv /home/path/folder1/ /home/path/folder2 2>rsync-errors
echo $?
cat rsync-errors

Alternatively, instead of using verbose mode, use --progress or -P to just see a progress indicator, that way you will see error messages scroll by. It is possible that they'll scroll too fast if there are a lot of them.

In any case, check that the return status of rsync is 0, indicating that there were no errors.

share|improve this answer
    
Thanks! (1) I have run my command. How shall I get the return status? (2) I have too many files to copy, and it takes hours. I cannot stare at the screen all the time. So the way of using progress may not work. But redirect the error stream to a file is a good idea. (3) I actually ran again with sudo rsync -azvv /home/path/folder1/ /home/path/folder2 > log_rsync. If I am correct, the error stream will still go to the terminal not the file? –  Tim Sep 16 '12 at 2:27
1  
@Tim 1) echo $? (0 means success). 3) Yes, redirecting either stdout or stderr will leave you with just the errors on the terminal or in the log file. –  Gilles Sep 16 '12 at 2:42
    
What does ? mean? –  Tim Sep 16 '12 at 4:55
1  
$? gives exit status of the last command. –  gorkypl Sep 16 '12 at 7:34
    
Thanks, Gilles! I realize that verbose mode severely slows down rsync. If I don't specify -vv or -v, will the error if any still be printed on terminal? What would you suggest to get the necessary output information while not slow it down as much as possible? –  Tim Sep 19 '12 at 12:22
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.