110 likes | 129 Views
Presented by Dave Mawdsley, DACS Linux Workshop Leader/Member February 17, 2016. Backups Using cwRsync. (using rsync from Linux in a Windows computer). What's this all about?. 1.
E N D
Presented by Dave Mawdsley, DACS Linux Workshop Leader/Member February 17, 2016 Backups Using cwRsync (using rsync from Linux in a Windows computer)
What's this all about? 1 • I have a Windows 7 user who runs a business and needs to make backups of his data. His older computer had failed and with it went his favorite paid synchronized backup program 'Save-N-Sync' that is no longer available. • I suggested to him that I was mostly finished writing a command script which would be an inexpensive replacement for his old program. • What I came up with was a Windows 7 command script which uses rsync from the Linux world running under the Linux environment Cygwin inside Windows 7. • In short, he's now using my inexpensive script customized to his needs and he is happy with the results.
First a Website to Visit 2 • A visit to https://en.wikipedia.org/wiki/CwRsync • gives this description: • “cwRsync is an implementation of Rsync for Windows. Rsync uses a file transfer technology specified by the Rsync algorithm, transferring only changed chunks of files over the network. cwRsync can be used for remote file backup and synchronization from/to Windows systems. cwRsync contains Cygwin DLLs and a compiled version of Rsync on Cygwin. A client GUI is also provided as of the version 5.0.0.”
Next a Download 3 • On the Windows 7 computer... • Visit: https://www.itefix.net/content/cwrsync-free-edition • to download the package: cwRsync_5.5.0_x86_Free.zip • and proceed to unzip the free client package. (The server version is a paid one.) • I chose put the extracted main folder contents in a directory folder cwRysnc in the user's Documents folder. (not in the folder Program Files)
4 Here's cwRsync's Contents • C:\users\MadMod\Documents\cwRsync now contains a bin folder and three other files. The bin folder contains .dll's pertaining to Cygwin. • We'll open cwrsync.cmd in Notepad and make some customizations and then save the new file as backup.cmd being careful to select All Files instead of Text just before saving.
backup.cmd changes necessary 5 • We first need to change in cwrsync.cmd the default rsync lines from: • rsync -r /cygdrive/c/work/ /cygdrive/e/work/doc/ • To my choice: (Note that its coding assumes a Bash shell at this point.) • rsync -r -t -p -o -v /cygdrive/c/users/MadMod/Desktop/ /cygdrive/e/Desktop/ • This assumes: • 1. the user is MadMod, (The Windows 7 path on drive C includes the users/<user>.) • 2. the Desktop folder is what needs to be backed up, • 3. drive e is the destination USB drive and • 4. the Desktop is a folder on drive e. (The USB drive doesn't require a users/<user>.) • For my customers, I usually recommend at least two more similar rsync lines: • 1. one for the Documents folder, • 2. one for the Pictures folder and • 3. one for the Downloads folder. • The cygdrive portion of the rsync command invokes the Cygwin .dll's. Note that the coding the rsync lines of this command script use the strict Linux Bash syntax, • but the other lines of backup.cmd use only Windows command notation which ignores spaces and upper vs lower case letters and requires \ in paths.
My Code p.3 8 For a non-Linux user, (Windows) my choice is white letters on a blue background. I used the command: COLOR 1F for this. I prefer a menu driven approach for the user which allows for a choice of the drive letter and choice to backup a folder or not. Unfortunately I'm forced to use GOTO MENU.
Concluding Remarks 9 • 1. Writing this customized command script in a mix of Windows and Linux styles reminds me of why I much prefer to write scripts using a Bash shell. I feel that the Window command (batch file) is primitive by comparison. Statements such as GOTO MENU looks like BASIC. • 2. Writing this script makes me wonder why there wasn't an rsync like command for Windows users. Copy and Xcopy just don't cut it by comparison to rsync as far as synchronization is concerned. • 3. I speculate that why such an algorithm as rsync didn't show up in the Windows command environment has to do with a long-tem behavior of Microsoft ignoring the average user's needs. Synchronized-style backups are clearly needed by almost all computer users. Microsoft left that need to be filled by 3rd party vendors selling their software sometimes at inflated prices. It is amazing that Microsoft couldn't see this need and thus profit themselves. • 4. I prefer synchronized backups. When a person needs a backed up file, they don't need the entire compressed archive.
This LibreOffice.org Presentation 'cwrsync.odp' and Microsoft Office Power Point Show 'cwrsync.pps' http://madmod.com/freebies.html Backups Using cwRsync 10 (using rsync from Linux in a Windows computer)