AlexanderPeters.nl

bloggerdeblog!

Rsync hangs with Cygwin

Geplaatst op: 19 December 2012 | Geen reacties
Van de prrrt-prrrt redactie

Those of you who have worked with linux before are probably familiar with rsync as a tool to transfer data, for example backups, over the network. It can transfer your files in an incremental way, very useful when syncing big folders over the network. As I wanted to copy files from a Windows server to a Linux server on a regular basis for backups I was looking for a similar tool and started using Cygwin, which can be used on Windows system to run ports of software like rsync. Using the task scheduler and a batch file I used cygwin, rsync and ssh to login over ssh on a remote linux server and transfer the files. This worked well, I thought, however…

At some point it didn’t work anymore. Output of the command didn’t specify any error, and also raising the verbosity level (by parameter -vv and -vvv) didn’t show any abnormality, the transfer just suddenly hangs. And with that, a deep Google journey started because as usual you have to find the solution for such a problem somewhere far away in archived mailing lists. It seems that using rsync under Cygwin often results in this problem, already known for years but no one has fixed this so far (see here)!. A workaround mentioned here to use the –bwlimit parameter to throttle the transfer didn’t work for me either.  I finally found a solution here. You have to compile rsync yourself and disable socketpair so that pipes are used instead. A quick how-to

  1. Download the source package of rsync (and some packages to compile: binutils, gcc, make, automake, autoconf, etc). You can do this by running the setup.exe of cygwin again (don’t worry, it won’t delete your installation) and selecting the ‘s’ of the rsync package (and remove the ‘b’ binary)
  2. Open the shell and go to the folder of the rsync source (i.e.: cd /usr/src/rsync-3.0.6/)
  3. run: ./prepare-source
  4. run: ./configure
  5. edit config.h, for example with nano or vi
  6. Comment out the line #define HAVE_SOCKETPAIR 1 by adding two slashes (//) before it, or, if not defined, add the line #define HAVE_SOCKETPAIR 0. Save the file
  7. Run: make, run: make install
  8. Use your compiled and new /usr/local/bin/rsync in scripts instead of /bin/rsync
  9. Happy rsyncing 🙂

Hopefully this will help someone out who is searching about this ridiculous problem.

 

Reacties

Reageer





AlexanderPeters.nl

Welcome! On this blog I post stuff that might be interesting for others or just random posts on daily life stuff. Some of my posts are in English, maar soms ook gewoon in het Nederlands, net waar ik zin in heb. Enjoy!

RSS feed

Last(.fm) played songs

  • Океан Ельзи - Як Довго
  • Океан Ельзи - Сосни
  • Океан Ельзи - Кішка

140 characters