2

I bought a new hard drive for my server, and I'm trying to reorganise my files. For the first transfer, rsync copied ~3 GB perfectly. However, with the equivalent rsync command, the second transfer fails.

$ sudo /usr/bin/nice -n 19 /usr/bin/ionice -c2 -n7 rsync -aEHAXPx /media/a/ /media/b --delete
...
rsync: [sender] write error: Broken pipe (32)
rsync error: error in socket IO (code 10) at io.c(820) [sender=3.1.1]

The first run copied about 550 of 800 GB before choking. More recent attempts only manage to copy 1 GB before dying. I'm not sure if it's relevant, but the source is a backintime incremental backup drive, so it contains a ton of hard links. How can I fix this error and complete the command?

I'm running rsync version 3.1.1 protocol version 31.

closed as off-topic by Sparhawk, GAD3R, Jeff Schaller, phk, Satō Katsura May 28 '17 at 15:35

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – Sparhawk, GAD3R, Jeff Schaller, phk, Satō Katsura
If this question can be reworded to fit the rules in the help center, please edit the question.

  • anything in dmesg ? (I have had rsync killed by the kernel for memory consumption before) – user1133275 May 26 '17 at 5:27
  • @user1133275 Huh, didn't think to look there. [85852.560086] Out of memory: Kill process 4242 (rsync) score 194 or sacrifice child [85852.562695] Killed process 4243 (rsync) total-vm:121948kB, anon-rss:65752kB, file-rss:4kB – Sparhawk May 26 '17 at 5:29
  • Please vote to close. I'm unable to reproduce this any more, because I solved the problem in other ways. (See comment to the answer.) – Sparhawk May 28 '17 at 11:18
3
dmesg | grep rsync

[85852.560086] Out of memory: Kill process 4242 (rsync) score 194 or sacrifice child [85852.562695] Killed process 4243 (rsync) total-vm:121948kB, anon-rss:65752kB, file-rss:4kB – Sparhawk

solutions:

  • change your rsync speed to below that of your disks.--bwlimit=6000 .. USB 2 is 60MB/s /4 for rw over 2 drives or /10 for seeking on non ssd... or get a XU4 with 2GB RAM and USB3.
  • change the kernel memory parameters echo 100 > /proc/sys/vm/watermark_scale_factor
  • force a memory purge during operation echo 3 > /proc/sys/vm/drop_caches
  • make sure you are using kernel 4.9.29 uname -r
  • Thanks (+1), I'll give the first solution a go and report back. My kernel is 4.4.35-v7+, but that's just what is provided by Raspbian :/. – Sparhawk May 26 '17 at 5:58
  • @Sparhawk yes the first option will likely fix the issue, side note: 4.4.70 is the latest for that branch, I'm not sure why it has not made it to the apt mirrors yet but if you want to try other kernels raspberrypi.org/documentation/linux/kernel/updating.md and github.com/raspberrypi/linux/tree/rpi-4.9.y – user1133275 May 26 '17 at 6:12
  • Oops I forgot about rpi-update. I just ran it and now I'm on 4.9.29-v7+. Were you suggesting that this might be adequate to fix the error? – Sparhawk May 26 '17 at 6:45
  • I just tried again on the new kernel, and got the same error. I'll try limiting to 6000 now. – Sparhawk May 26 '17 at 7:58
  • @Sparhawk it has happened that memory management in the kernel was change to be less than ideal for low memory boards, but clearly in this case rsync is unstable on the last 35 kernel fix sets. so yah try bwlimit. – user1133275 May 26 '17 at 11:42

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