2

I use rsync on Windows (Cygwin), where I move files from shared folder (from another Windows instance) to NFS storage. I have mapped the shared folder to one drive and mounted the NFS folder to another.

I started the rsync command this way:

C:\cygwin64\bin\rsync.exe -vrH --perms --partial --delete --stats --log-file=/home/Administrator/rsynclogs/backup.log /cygdrive/z/ /cygdrive/w/

After 30 minutes of running and about 17,000 files transferred if failed on error:

rsync: write failed on "/cygdrive/w/domainName/Uploads/index_635244981053162421.html": Permission denied (13)

I can't see any reason for the permission denied error. For example, if I copy the file by hand it copies successfully.

I know that this is a shortcoming of the rsync protocol. The rsync protocol can't determine beforehand if it has write permissions at the target. Instead it just sends and checks for success or failure afterwards.

I don't have ssh access to the NFS server - it's a storage instance. The source Windows client has Cygwin but does not have access to the NFS storage.

We are moving from an old 2008 server to anew one. One of the changes is to move all storage to a shared nfs storage. I know that this configuration is not perfect, but it's temporary. I need it to work properly for a month or so. NFS service can't be installed on the 2008 server unfortunately otherwise there wouldn't any need in rsync.

How can I make my copy continue running even if there is an error?

I thought using those options:

 --partial-dir=DIR
 --delay-updates
 --inplace
 --ignore-errors

but it looks like it won't really solve my problem. Any suggestions?

  • 4
    I'm voting to close this question as off-topic because it is not about Unix or Linux. – Sparhawk Dec 11 '18 at 9:47
  • I would recommend asking on another site, such as SuperUser. – Sparhawk Dec 11 '18 at 9:47
  • 3
    @Sparhawk Cygwin is not off topic here – roaima Dec 11 '18 at 9:49
  • 2
    @roaima Oops. Apologies. I missed that (slightly hidden) part, and assumed it was about a Windows port of rsync. – Sparhawk Dec 11 '18 at 10:58
  • Hello Matisa, 1. You've got a permission denied error on a file. What happens if you try to copy or create the target file yourself (copy, notepad, explorer, whatever). I'd like to ascertain whether it's rsync failing, or if there is a real permissions issue on the target. 2. If you rerun the rsync command does it carry on from where it left off? And if not, what happens? – roaima Dec 11 '18 at 11:18
4

I would suggest that you modify your rsync command to maintain file times, so that it can identify whether or not a file needs to be recopied. Use the --times flag (-t) for this.

You have stated that your permissions error is transient, so I would suggest you just put the process into a loop. Put this into a file and run it from bash

#!/bin/bash
while :
do
    rsync -rptv --partial --delete --stats --log-file=/home/Administrator/rsynclogs/backup.log /cygdrive/z/ /cygdrive/w/ && break
    sleep 30
done

As a possible improvement you may want to consider replacing the flags -rpt with -a (--archive), which also maintains file ownership.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.