rsync suddenly hanging indefinitely during transfers

后端 未结 13 1162
囚心锁ツ
囚心锁ツ 2021-01-30 20:34

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

相关标签:
13条回答
  • 2021-01-30 20:44

    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 "
    
    0 讨论(0)
  • 2021-01-30 20:48

    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.

    0 讨论(0)
  • 2021-01-30 20:49

    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.

    0 讨论(0)
  • 2021-01-30 20:50

    In my situation rsync was not actually failing.

    I have regular server backups which transfers large files over 500GB+ and have --append-verify or --checkusm over ssh parameters specified.

    What I have found upon analysis is that once the client side completes it's file checks then the server side checks start. Which means while the server is doing it's checks the client side will appear hanged and frozen - run htop on the server to rsync working away.

    This is likely a non issue if rsync is run in deamon mode on the server and using the rsync protocol instead of ssh for transfers.

    On related note, this very LONG wait would trigger SSH timeout and a rsync: connection unexpectedly closed (254 bytes received so far) [sender] error message, sollution is to add ClientAliveInterval 120 and ClientAliveCountMax 720 to /etc/ssh/sshd_config.

    0 讨论(0)
  • 2021-01-30 20:51

    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.

    0 讨论(0)
  • 2021-01-30 20:53

    Holger Ohmacht aka h8ohmh / 8ohmh:

    The problem lies in the filesystem buffer / usage of the interworking of harddisk/hw so far as I could investigate.

    Temporal solution for local drives (eg. USB3<->HD) : A script which is polling the changing disk space. If no changing free disk space then rsync is stalled and has to be restarted

    cmd="rsync -aW --progress --stats --preallocate --super \ <here your source dir> \ <here your dest dir>" eval "$cmd" &
    rm ./ndf.txt rm ./odf.txt while [[ 0 == 0 ]]; do df > ./ndf.txt cmp ./odf.txt ./ndf.txt res="$?" echo "$res" if [[ $res == 0 ]]; then echo "###########################################" ls -al "./ndf.txt" ls -al "./odf.txt" killall rsync eval "$cmd" & else cp ./ndf.txt ./odf.txt fi sleep 60 done
    Change <source dir> etc to your paths!

    In my case it is always stalling by usage of rsync's --preallocate option (normally because of better disk performance and rescueing continuous blocks), so as long as the disk and filesystem drivers not reworked there just this solution

    0 讨论(0)
提交回复
热议问题