To backup windows using rdiff-backup to another computer, four sub-systems need to be configured:
Just follow the instructions on cygwin.org and remember to include rdiff-backup (and rsync if you need it)
Here is my script:
rdiff-backup /cygdrive/c/Common jordan-backup::/backup/stillwater/Common rdiff-backup /cygdrive/c/Users\ Shared\ Folders jordan-backup::/backup/stillwater/UsersSharedFolders rdiff-backup --exclude-globbing-filelist sw-exclude.txt /cygdrive/c jordan-backup::/backup/stillwater/c
This assumes that there is an “exclude” file in the same directory in which the program is run from. See at the end for mine. I also wanted to do a database dump into a directory that would be backed up. Here is my dump command:
'/cygdrive/c/Program Files/MySQL/MySQL Server 5.0/bin/mysqldump.exe' -u xxxx -p --compress --add-drop-table --extended-insert -A > /cygdrive/c/Common/MySQLBackup/stillwater.sql
An excellent tutorial for this is available on: arctic.org/…up/unattended.html but note that they are initiating backup from the host.
(A cached version is available here.)
#useradd --home /var/backups --create-home --shell /bin/false backup # already created in Ubuntu mkdir /var/backups/.ssh chown backup /var/backups/.ssh su -m backup # Create a passphrase-free ssh key ssh-keygen -t rsa #Enter file in which to save the key (/backup/.ssh/id_rsa): /var/backups/.ssh/id_rsa_myserver_backup #Enter passphrase (empty for no passphrase): chmod -R go-rwx /var/backups/.ssh scp /var/backups/.ssh/id_rsa_myserver_backup.pub root@client:.ssh/
su #make sure you are root if backups are run as root MYSERVER=servername chmod 700 ~/.ssh/id_rsa_${MYSERVER}_backup echo "host ${MYSERVER}-backup" >> ~/.ssh/config echo " user backup" >> ~/.ssh/config echo " hostname $MYSERVER" >> ~/.ssh/config echo " identityfile /root/.ssh/id_rsa_${MYSERVER}_backup" >> ~/.ssh/config echo " protocol 2" >> ~/.ssh/config #echo " compression yes" >> ~/.ssh/config # if necessary #echo " port 7654" >> ~/.ssh/config # if necessary ssh ${MYSERVER}-backup # try connecting with no password
Create a file called daily-backup.bat (the —login creates path and environment variables):
C:\cygwin\bin\bash --login \common\scripts\rdiff.sh
Create a file called rdiff.sh (which must have unix line endings):
#!/bin/bash rdiff-backup commands... (as tested above)
/cygdrive/c/backup /cygdrive/c/Common /cygdrive/c/Users?Shared?Folders /cygdrive/c/download /cygdrive/c/TEMP /cygdrive/c/pagefile.sys /cygdrive/c/WINDOWS/system32/config /cygdrive/c/WINDOWS/system32/wins ignorecase:/cygdrive/c/**ntuser.dat ignorecase:/cygdrive/c/**UsrClass.dat ignorecase:/cygdrive/c/**/*.dat.log /cygdrive/c/Program Files/Exchsrvr /cygdrive/c/Program Files/Microsoft?SQL?Server /cygdrive/c/System?Volume?Information /cygdrive/c/WINDOWS/NTDS /cygdrive/c/WINDOWS/ntfrs /cygdrive/c/WINDOWS/Debug /cygdrive/c/WINDOWS/SoftwareDistribution/EventCache /cygdrive/c/**/*webpam.lck
rdiff-backup --list-changed-since 35D root@jordan::/backup/sv/home/common/Active\ Files/Willson/
rdiff-backup -r 7D root@jordan::/backup/sv/home/common/Active/file2012.txt /home/common/Active/file2012.txt
rdiff-backup -r 2019-12-20 /back/cfa/rdiffbackup/homesv3/common/support/ /back/support_old/
rdiff-backup --force --remove-older-than 4W /backup/cfahome