2009-09-22

Using cwrsync for unofficial backups to my laptop.

I use rsync as my personal, speedy, non-enterprise backup solution.

I have valuable information scattered across several Unix environments. Frequently, I have to change this information. I back up my data to a Unix repository box using rsync. Because I am suitably paranoid, I also want a copy on my laptop as well.

My work laptop has a Windows OS. I use cwrsync on my laptop to pull the backup data from my Unix hosts. I create a directory for each Unix host that I want to back up and create a Windows batch file for each host. Below is an example batch file. It backs up /home/myid and /usr/src on the source box.

C:\Users\myid\Documents\system backups\somehost>more rsync_pull.bat
"c:\program files\cwrsync\bin\rsync.exe" -r -l -t --progress --exclude="src/BUILD" --exclude="src/logs" --rsh="c:\'program files'\cwrsync\bin\ssh.exe" somehost:/home/myid :/usr/src .

Here I am running the batch file. I have a new package file, as well as the two example files I made for this demonstration, plus other minor files.

C:\Users\myid\Documents\system backups\somehost>rsync_pull.bat
"c:\program files\cwrsync\bin\rsync.exe" -r -l -t --progress --exclude="src/BUILD" --exclude="src/logs" --rsh="c:\'program files'\cwrsync\bin\ssh.exe" somehost:/home/myid :/opt/isv/src .
somehost.ourdomain
myid@somehost.ourdomain's password:
receiving file list ...
77 files to consider
src/
src/RPMS/x86_64/
myid/.bash_history
       10312 100%    9.83MB/s    0:00:00 (xfer#1, to-check=75/77)
myid/.ssh/known_hosts
        1600 100%   78.12kB/s    0:00:00 (xfer#2, to-check=66/77)
src/RPMS/x86_64/httpd_mymodule-1.0-1.x86_64.rpm
        2962 100%   52.59kB/s    0:00:00 (xfer#3, to-check=27/77)
src/example.1
       10828 100%  139.13kB/s    0:00:00 (xfer#4, to-check=2/77)
src/test.2
         436 100%    4.30kB/s    0:00:00 (xfer#5, to-check=0/77)

sent 267 bytes  received 15605 bytes  2441.85 bytes/sec
total size is 24667445  speedup is 1554.15

Here is what the directory listing looks like. The final directory in the rsync source designation becomes the subdirectory name in the target parent directory.

C:\Users\myid\Documents\system backups\somehost>dir
 Volume in drive C has no label.
 Volume Serial Number is CCCC-7777

 Directory of C:\Users\myid\Documents\system backups\somehost

12/09/2009  03:02 PM    <DIR>          .
12/09/2009  03:02 PM    <DIR>          ..
02/13/2010  03:20 PM    <DIR>          myid
02/05/2010  12:02 PM               209 rsync_pull.bat
02/04/2010  05:23 PM    <DIR>          src
               1 File(s)            209 bytes
               4 Dir(s)  112,225,009,664 bytes free

No comments:

Post a Comment