7

Is there a way to build a Windows server what can be target for other Windows file servers with rsync ?

7 Answers 7

4

While MarkM has a good point about DFS-R, if you want to still use rsync, then cwrsync is a great Windows version of rsync, which includes a client & server, and can also use encryption. I have used this package on Windows for years. It works great, but (in my experience) can sometimes have slower than expected file transfer times.

2
  • Primarily I'm a UNIX based sysadmin, and I experienced with rsync, so first I will use cwrsync. And I read after this DFSR solution.
    – Glendyr
    Mar 23, 2011 at 21:33
  • Only the paid version is offering server. Aug 19, 2020 at 13:43
3

Is there a reason that you want to use rsync? If I were you, I'd go with the native DFS-R functionality built into Windows.

3
  • DFS-R is your best bet. Compression rates on RDC are sick! We get > 90% in a lot of cases.
    – BoxerBucks
    Mar 23, 2011 at 21:15
  • Thank you, I will look at it. Never heard of it until now.
    – Glendyr
    Mar 23, 2011 at 21:32
  • In our organization we primarily use DFS-R, but for our incremental offsite transaction log backups which have constraints on when they need to be transferred it's completely unacceptable because the complexities of the staging folders and lack of guarantees as to WHEN the files would be transferred meant that we were often experiencing backlogs and delays. The other case is for software releases where we need to update content across an entire set of web or application servers. They MUST be updated synchronously in our system. So for those two types of transfers, we use Rsync instead.
    – ryandenki
    Dec 12, 2011 at 6:24
3

You can easily create a Windows rsync server using Cygwin with rsync package. All you have to do is install Cygwin and make sure you include rsync (listed under 'Net' category using setup-x86_64.exe installer). After Cygwin is installed on your server open a terminal window/session and do the following:

  1. Create rsyncd.conf file on server

  2. Inside rsyncd.conf add config info ex)
    auth users = myuser secrets file = /home/myuser/rsyncd.secrets hosts allow = 192.168.1.2,192.168.1.8 log file = /home/myuser/rsyncd.log port = 8730 use chroot = yes read only = yes [Share1] path = /cygdrive/e/pathtofolder [Share2] path = /cygdrive/f/pathtofolder Modify config to meet your specific needs.

  3. Create rsyncd.secrets file on server and add secrets inside file ex)
    myuser:mysecretpassword

  4. Protect rsyncd.secrets file on server (also required to properly run rsync daemon) ex)
    chmod 600 ./rsyncd.secrets

  5. Test/Run daemon via cli on server ex)
    rsync --daemon --config=/home/myuser/rsyncd.confg --no-detach

  6. Test rsync server connection from a client machine with rsync installed aswell ex)
    rsync -rdt rsync://myuser@rsyncserver:8730
    Command should list available shares.

  7. Test rsync server auth from client machine (enter password when prompted) ex)
    rsync -rdt rsync://myuser@rsyncserver:8730/Share1 Password:mysecretpassword Command should list all files in specified share.

  8. Something I've also learned about using Cygwin with rsync on Windows is that you also want to change your fstab file (located usually in Windows directory C:\cygwin64\etc on server or client) to include the noacl option otherwise you can run into all kinds of weird file permission issues when syncing. ex)

# /etc/fstab # # This file is read once by the first process in a Cygwin process tree. # To pick up changes, restart all Cygwin processes. For a description # see https://cygwin.com/cygwin-ug-net/using.html#mount-table # This is default anyway: none /cygdrive cygdrive binary,noacl,posix=0,user 0 0


If any errors occur check server's rsyncd.log (as configured /home/myuser/rsyncd.log)


References:

5
  • Apparently, the rsync.exe binary alone cannot run as a service. For that purpose, Cygwin has a tool called cygrunsrv, which appears to be a "generic service shim", similar to NSSM if you know that one (would be my other choice). After some trial and error, I've managed to install cygnusrv+rsync using the following curse: C:\cygwin64\bin\cygrunsrv -I RsyncServer -n -p /bin/rsync.exe -a "--daemon --no-detach --config=/cygdrive/c/your_custom_directory/rsyncd/rsyncd.conf"
    – frr
    Aug 8, 2022 at 15:00
  • 1
    I ended up appending -c "/cygdrive/c" to the cygrunsrv command line, as otherwise rsync.exe would start in a CWD of C:\Windows\System32\ or thereabouts, and it would base all the module/share paths from there, which can only lead to errors. So the point is to set a sane working directory to rsyncd. Even then, miraculously, the Windows build of rsync would somehow include some "phantom" paths in the per-share directory listings, which I needed to exclude per module/share evia rsyncd.conf: exclude = /dev /proc /cygdrive . Otherwise I'd get errors about vanishing dirs.
    – frr
    Aug 12, 2022 at 10:12
  • 1
    Security notes, and these are rsync-generic, rather than Windows-specific: 1) "auth users" also works per share. 2) Another useful option is "list = no", which hides the share from rsync -rdt, which is possibly desirable, after some initial testing, for production operation. A combination of these two allows you to serve different shares to different users or client machines with different levels of trust, handling data with different levels of sensitivity.
    – frr
    Aug 12, 2022 at 10:19
  • ...and, after some initial success, miraculously I've managed to mess up Windows permissions on rsyncd.secrets to the extent that rsync.exe would refuse to use it, on the grounds of "being visible to others". The chmod 600 no longer worked. So I had to resort to "strict modes = no" - and I did take care to rectify the Windows privileges such that the password file would not in fact be readable to anyone except the desired user. Another side note: upon any change to rsyncd.conf, rsync.exe seems to notice immediately, no need to reload the service. That's nice! :-)
    – frr
    Aug 12, 2022 at 10:35
  • I think this should be the accepted answer. Thanks to @frr
    – Hipponax43
    Aug 13, 2022 at 13:59
1

I have found a great tool Yintersync - Rsych for Windows to manage replicating multiple windows servers back to one. I replicate over 2tb daily from 10 servers over a 2mbit broadband connection using it.

0
0

Use DeltaCopy - http://www.aboutmyip.com/AboutMyXApp/DeltaCopy.jsp

1
  • Beware that DeltaCopy uses an ancient version of cygwin1.dll causing it to not support unicode file names, which will silently fail to copy
    – Tom Lint
    Jul 21, 2020 at 10:16
0

The backuppc package has a link to a minimal rsyncd implementation. It is based on cygwin, and only provides the rsyncd daemon service. It is a 32 bit implementation, but runs well on Windows 7 64 bit.

There is also a link to another set of packages package that includes an sshd service as well.

0

You can use the Windows Subsystem for Linux (WSL) version of rsync rather easily nowadays.

Install wsl using this command at an admin command prompt

wsl --install --inbox

This installs the version that can be run over ssh. If you have another version which does not work over ssh you may need to do a full uninstall (including disabling the wsl windows component and rebooting), then reinstall using the above command.

Then create a text file with the following contents

@echo off
wsl rsync %*

and save it as rsync.bat. Now place that file anywhere on your path.

When you try to rsync to your windows server, the rsync.bat script will be called, which wil in turn call the wsl version of rsync (passing all the arguments to it as well).

You can now rsync between your Windows system and also Linux systems too.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .