1

The Problem
I've setup my Raspberry Pi 1B+ running DietPi as a Time Machine backup destination as per this tutorial. I have attached a 2TB Western Digital USB 3.0 disk. Obviously this is an old Pi so I am not expecting great speeds, but I get 6 MB/s and I have trouble figuring whether the bottleneck is the CPU or the shared network / USB controller.

The Details

  • The CPU is set to 900 MHz, 250 MHz core, 400 MHz SDRAM, 2 overvolt.
  • The Pi is connected directly to the router with a Cat 5E cable. I have also tried with a USB to Ethernet adapted in between, this made no difference.
  • I have done a local disk write benchmark to gauge the external disk performance using dd bs=10M count=50 if=/dev/zero of=/mnt/timemachine/test.bin; 17.4 MB/s.
  • I have done a network test between my MacBook and the Pi using iperf with the Pi as the server; 83.6 Mbits/sec. During this, Pi CPU usage was around 85%.
  • I have done a remote disk write benchmark from the MacBook to the Pi using dd bs=10M count=50 if=/dev/zero of=/Volumes/timemachine/test.bin; 6756683 bytes/sec (~6.75 MB/s). During this, Pi CPU usage was around 100% (the smbd i.e. Samba process specifically).

The Speculation

  • From the local disk write benchmark, it appears that the disk or USB hub by itself is not the bottleneck.
  • From the network test between the client and Pi, the 83.6 Mbit/sec would indicate that the maximum Ethernet speed I can expect is ~10.5 MB/sec, without any of the overhead of Samba etc.
  • From the remote disk write benchmark, it appears that either the CPU or the shared USB / Ethernet controller is the bottleneck. Given that 6.75 MB / sec * 8 = 54 Mbit / sec, this is only a fraction of the theoretical 480 Mbit / sec of USB 2.0 that the B+ controller should be capable of, even if overhead is taken into account. The CPU usage appears to indicate a bottleneck there, but lowering the CPU to the default profile of 700 MHz, 250 MHz core, 400 MHz SDRAM, 0 overvolt does not appear to impact performance.

The Question
Is the current bottleneck the CPU, or the shared USB / Ethernet controller, and how large is the difference?
In case of the former, it is straightforward to upgrade. If it is the latter, it must be an RPI 4 or some other fancy SMB that provides a gigabit ethernet without sharing a bus with the USB hub, which is costly.

3
  • Just out of curiosity, how can Time Machine via RPi via Samba via USB external drive be faster than Time Machine via USB external drive? Or am I missing something?
    – Seamus
    Apr 17, 2023 at 22:43
  • @Seamus I don't expect it to: though I didn't list it here, Time Machine via USB on the MacBook directly is indeed faster, BlackMagic gives ~140 MB/s if I remember correctly. The local disk write benchmark was done on the Pi, not the MacBook. The reason I don't connect the disk to the MacBook directly is that it is a backup drive for multiple laptops, so with a networked disk the process is fully automated instead of having to plug in. Apr 18, 2023 at 6:58
  • Time Machine has throttling built-in. Though it's unlikely the culprit I would try disabling it to see if your speeds improve. I've noticed a massive speed up for attached drives with throttling disabled. Disable it with sudo sysctl debug.lowpri_throttle_enabled=0 and sudo sysctl debug.lowpri_throttle_enabled=1 to re-enable throttling (though I'm pretty sure this value resets to enabled after reboot). Oct 10, 2023 at 18:59

1 Answer 1

0

TLDR: It is probably a CPU bottleneck due to Samba overhead or and maybe also the shared usb bus for the fast ethernet adapter and maybe the filesystem you are running?

I ran a RPI 1 (non plus!) as a media Samba server for quite a while until I recently finally was able to buy a 4 to upgrade to. I ran my 1 with a usb gigabit ethernet adapter(https://www.jeffgeerling.com/blogs/jeff-geerling/getting-gigabit-networking). I was also running NTFS as a filesystem because I wanted to keep compatibility with other computers on those disks. This is stupid of me because it causes additional overhead but with some tweaks I could keep manageable. Example fstab:

UUID=740E4C1B0E4BD530 /mnt/usbexpansion ntfs nofail,big_writes,uid=pi,gid=pi 0 0

If you don't need this, experiment with different filesystems, some have less overhead than others.

It ran rock solid with two disks attached for many months and I got around 5-10 MB/s throughput when clocked down a little bit for power.

I still run these tweaks now that I run a 4 but now I get a solid 80+ MB/s.

Also, keep in mind that the theoretical 480 Mbit / sec of USB 2.0 should be halved as USB 1.0 and USB 2.0 connections are half-duplex. So the theoretical limit is actually 240 Mbit. If you combine this with the fact that the onboard (or external) ethernet runs of the USB bus, you can halve this again to get to 120 Mbit each, which means the theoretical maximum on any of the USB 2 based boards will be 15MB/s. Slap some overhead on top of this and you are not far off.

Also also, my usb hard disks did not spin down at all by default and had to mess with them to get them to spin down, I think this was because my disks were a bit strange in how they handled idle.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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