Windows, WHY ARE YOU ALWAYS SO DIFFICULT! Gosh. Damn you are. This time. i wanted to do schedule a backup from my windows server 2012r2 to my linux backup drive. Its as simple as that (while i though it was at least). Google doesn't help with so many rubbish online. Hence, here is a guide that will help us out (me included)
Environment
Enterprise server (Windows 2012 R2)
This is a windows environment server 2012 R2 where our data is
Backup server (Debian Linux)
This is my backup server where i would like to rsync over.
Installation
On Windows server 2012 r2
- Download cwRsync
- Unzup cwRsync and copy to "C:\cwRsync".
- Add "C:\cwRsync\bin" to PATH.
- Create the directory "C:\cwRsync\home" and "C:\cwRsync\home\USER" (USER should be the name of the user who will run the Rsync in my case its "admin").
- Create public/private keys with the following command:
-
ssh-keygen -t rsa
- Paths with "/home/USER/" correspond to the directories that we created in "C:\cwRsync\".
- Leave the password blank.
On Linux
- Install openssh-server and rsync.
- Provide data to a partition (eg.: /backup/).
- Place the public key in /home/USER/.ssh/ and rename the file to authorized_keys. (assuming its root)
On Windows
- Test the connection without a password with the following command:
ssh USER@BackupServerIP
- Test Rsync:
rsync -v -rlt -z --delete "/myfiles/" "USER@BackupServerIP:/backups/"
- where cygdrive is the directory on C:\cygdrive so the above C:\cygdrive\myfiles
- To Test Other port
rsync -e "ssh -p 14000" -arv "--exclude=.svn/" /myfiles USER@BackupServerIP:/backups/
- Create a bat file with the rsync command and place it in C:\cwRsync\bin.
- Schedule execution every day at 0:30 (half past midnight).
Helpful Resources
- http://stackoverflow.com/questions/34147565/rsync-uid-gid-impossible-to-set-cases-cause-future-hard-link-failure-how-to
- http://www.smellems.com/tiki-read_article.php?articleId=14