rsync suddenly hanging indefinitely during transfe

2020-05-15 15:28发布

For the past few years, I have been using an rsync one-liner to back up important folders on my Mac Mini desktop (OSX 10.9, 2.5 GHz i5, 4 GB RAM) to a FreeNAS box (0.7.2 Sabanda revision 5266, Pentium D 2.66 GHz, 822MiB RAM [reported by the system, I think there's 1 GB in there]). I am running an rsync daemon on the FreeNAS box. Recently, these transfers have been hanging indefinitely. I have done the usual Google-fu and am unable to identify the source of the problem or a solution.

The one-liner is:

rsync -rvOlt --exclude '.DS_Store'                                  \
      --exclude '.com.apple.timemachine.supported'                  \
      --delete /Volumes/Storage/Music/Albums/ 192.168.1.100::albums

I have tried enabling -vvv and --progress, but there is no pattern that I can discern between what hangs and what doesn't. Heck, if I retry, the same file might hang at a different point during the transfer or not at all. A dry run (-n) does not always succeed either. The only "success" I've had is implementing a timeout (--timeout=10) and rerunning the command over and over. Eventually, I creep along, but with no guarantee of success and at a pace that is unacceptable. I've reached a point where I have one file that I can't get past.

The Mac Mini is connected to my router via 5 GHz. The FreeNAS box is wired into that same router on a 100 mbit port. When transfers are actually going, rsync --progress reports 2.5-4 MB/s. According to --progress, a hang is literally just that—no data transfer is occurring as far as I can tell.

I need help with both the diagnostics and the solution.

标签: macos rsync nas
12条回答
Fickle 薄情
2楼-- · 2020-05-15 15:36

This happened to me when the remote device ran out of space. The error wouldn't show when --verbose option was used; turning that off yielded some STDERR output that explained that the remote device was out of space. When I freed some space, I was able to run rsync again with --verbose and everything went fine.

查看更多
Ridiculous、
3楼-- · 2020-05-15 15:36

It also happens when the user on target machine has not write permissions on target folder.
You can try giving write permission to others target folder:

sudo chmod -R o+w /path/to/target-folder
查看更多
老娘就宠你
4楼-- · 2020-05-15 15:37

I was having the same problem and it was because I was running out of memory during the rsync. Created a swap file and problem solved.

查看更多
一纸荒年 Trace。
5楼-- · 2020-05-15 15:42

Had rsync hanging issue on Ubuntu 16. None of the options above helped. The problem was in the source drive (external SSD) which suddenly became faulty. I tried several disk checks, but all of them stuck. Ended up rebooting the system and disk suddenly became accessible again.

查看更多
Explosion°爆炸
6楼-- · 2020-05-15 15:43

I was having the same problem. Removing -v didn't work for me. My use-case is slightly different in that I'm going from source (EXT4) to ExFAT. The issue for me was that rsync was attempting to preserve device files and permissions, which ExFAT doesn't support. I was using the -hrltDvaP switches. The -D and -a switches seemed to be my problem. The -a switch translates to -rlptgoD (no -H,-A,-X). The -p, -g, and -o switches seemed to be my root cause as rsync was barfing on one or all of those during runtime. Removing -a and specifying -Prltvc switches explicitly is working for me.

bkupcmd="nice -n$nicelevel /usr/bin/rsync -Prltvc --exclude-from=/var/tmp/ignorelist "
查看更多
兄弟一词,经得起流年.
7楼-- · 2020-05-15 15:43

Just had a similar problem while doing rsync from harddisk to a FAT32 USB drive. rsync froze already in less than a second in my case and did not react at all after that ... left it with CTRL+C.

Found out that the problem was a combination of usage of hardlinks on the harddisk and having FAT32 filesystem on the USB drive, which does not support hardlinks.

Formatting the USB drive with ext4 solved the problem for me.

查看更多
登录 后发表回答