0

So, I'm trying to setup a Samba share on my R Pi 4 for my home network. I'd really like it it be Samba because at lease 1 Win10 machine is involved.

The setup is as follows:

  • External USB 3 HDD is attached to the R Pi and auto-mounted via /etc/fstab.
  • Samba server is set up to use this disk as a share: https://pastebin.com/uYWW70Ez

I have both devices on a 1Gbps Ethernet network, still transfer speeds are:

  • Upload to Samba share: ~32MB/s
  • Download from Samba share: ~19MB/s (it actually starts with ~60MB/s, but then heavily drops and fluctuates randomly between 9MB/s and 24MB/s)

During Samba upload/download R Pi CPU is no more than 50% loaded; and there's spenty of memory as well.

I'm pretty sure it's not HDD (although it being NTFS-formatted). dd tests tell it can perform a lot faster at the R Pi:

$ sudo dd if=/dev/sda of=/dev/null bs=16M count=100 status=progress iflag=direct
...
1677721600 bytes (1.7 GB, 1.6 GiB) copied, 18.5466 s, 90.5 MB/s
$ sudo dd if=/dev/zero of=/mnt/usb_hdd/blob bs=16M count=100 status=progress oflag=direct
...
1677721600 bytes (1.7 GB, 1.6 GiB) copied, 22.2178 s, 75.5 MB/s
$ sudo dd if=/mnt/usb_hdd/blob of=/dev/null bs=16M count=100 status=progress
...
1677721600 bytes (1.7 GB, 1.6 GiB) copied, 23.3002 s, 72.0 MB/s

This is also not a network: write/read to/from a Samba share backed up by a RAM-disk are >100MB/s.

On the other hand, I've discovered Pi's internal SD card being terribly slow which correlates with a terrible Samba upload speed to HDD:

$ sudo dd if=/dev/zero of=~/blob bs=16M count=100 status=progress oflag=direct
...
1677721600 bytes (1.7 GB, 1.6 GiB) copied, 90.1067 s, 18.6 MB/s
$ sudo dd if=~/blob of=/dev/null bs=16M count=100 status=progress
...
1677721600 bytes (1.7 GB, 1.6 GiB) copied, 36.7608 s, 45.6 MB/s

So what the hell is going on here?? And how do I improve my precious Samba setup speed?

2 Answers 2

1

OMG, seems like I've solved it! Now both Samba read/write are at ~70MB/s.

To improve writing: add big_writes option to your /etc/fstab mounting NTFS HDD.
Note that this option is deprecated since 2016 (libfuse 3.0.0), but R Pi is still using 2.9.9.

To improve reading: add write cache size = 2097152 to your /etc/samba/smb.cfg (looked up here)

3
  • 2
    Better still DON'T USE NTFS. It performs poorly on Linux - use ext4.
    – Milliways
    Mar 6, 2021 at 22:06
  • @Milliways is correct. There is absolutely no need to use NTFS as the file system for your Samba drive - use the native ext4. And dd is notoriously slow (inefficient) with small block sizes... that said, your question might benefit if it included an explanation of what dd has to do with this.
    – Seamus
    Mar 7, 2021 at 7:29
  • 1
    @Seamus, do you mean 16Mb blocks are small for dd test? At least that's roughly the size duplicity uses to write files to this share. Thus it's representative to me. Regarding NTFS: my reading of dd results is no matter the filesystem it won't read faster than 90MB/s (see the first dd) - that's only 20MB/s faster than what I have with NTFS now. The disk was already NTFS, I was lazy to reformat and the majority of devices are on WiFi - they won't notice ) Although the real argument against NTFS is fragmentation... Mar 7, 2021 at 11:49
0

Thanks for sharing this (I don't have enough points to comment so I'm using the answer method). Your suggestion of write cache size = 2097152 helped a bit (but not enough). I'm hoping / praying for a vast NTFS performance improvement with Paragon's release of an NTFS driver, progress of which I have been tracking at this website: https://www.phoronix.com/scan.php?page=news_topic&q=Linux%20Storage

Your Answer

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

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