Please someone advise on this. I have a 2,5" external HDD attached to the router which supports USB 3.0. I got good speed when copy some file to the HDD directly connected to the laptop. When I use SMB share the writing goes up to only 20MB/s. I did some checks below:
/dev/sda1: LABEL="Maxtor" UUID="bbf25799-766c-e345-b611-037ea0ba2b1b" TYPE="ext4" PARTUUID="e177740a-01"
root@XiaomiMiRouter3G:~# lsusb -D /dev/bus/usb/002/003
Device: ID 0bc2:61b6 Seagate RSS LLC Maxtor HX-M101TCB/GM [M3 Portable 1TB]
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 3.00
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 9
idVendor 0x0bc2 Seagate RSS LLC
idProduct 0x61b6 Maxtor HX-M101TCB/GM [M3 Portable 1TB]
root@XiaomiMiRouter3G:~# hdparm -tT /dev/sda1
/dev/sda1:
Timing cached reads: 284 MB in 2.01 seconds = 141.54 MB/sec
Timing buffered disk reads: 288 MB in 3.00 seconds = 95.92 MB/sec
root@XiaomiMiRouter3G:~# lsusb -t
/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci-mtk/1p, 5000M
|__ Port 1: Dev 2, If 0, Class=Mass Storage, Driver=usb-storage, 5000M
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci-mtk/2p, 480M
This is when the HDD is connected to the laptop itself:
I know this is a router and I would not expect any better, but I have read from several people (that is the experience) using samba with this router, that 2 or even 3 times higher transfer speed can be reached, but unfortunately, so far, I could not figure out what do I do differently.
@ reinerotto Okay, I will try it. Thanks for the suggestion.
Can I format the disk within Openwrt? I did install Ubuntu under Vmware Workstation 14 pro, the usb controller supports 3.0, but my device is not visible, maybe it is not support ext4?
Sorry, I do not remember details, so I can only agree to your posting, that in general you are correct. You have the important features: noatime, and journal disabled. Very good.
Be advised, that there is some type of "automount" in /etc/config, which you might use.
Something like
uci set fstab.@mount[0].enabled='1'
uci set fstab.@mount[0].options='noatime'
Sorry, no more details available.
Just a note: You really need to distinguish between read and write speeds. Performance differs wildly between reading and writing.
These are read speeds. Don't expect to get anything close to that for write speeds. I will gladly stand corrected, but I'd say realistically you can expect ~30 MB/s, give or take a few. You can do a quick test for your write speed using the following command:
# time dd if=/dev/zero of=tempfile bs=1M count=1024
(adjust the output file to be written to a mounted filesystem of course). This will write a 1024 MB test file to disk. OpenWrt's dd does not state speed itself, so we time the action and you divide 1024 by the resulting seconds to get MB/s.
You will probably find that you can't even directly write to your disk at the "2 or 3 times", i.e. 40 to 60 MB/s speed you expect. I know my 800 MHz MBL SoC can't break 30 MB/s at write, and the drive there is connected straight to on-board SATA. Combined with the fact that samba itself takes up significant CPU performance, you will probably have to adjust your expectations.
You can try to optimize your file system, but don't expect anything close to a 2 or even 3 times performance increase. Personally, I found that beyond "sensible" settings ("noatime" is really a no-brainer), these optimizations don't really make much of a performance difference in the end. The main limitation is your CPU, and maxing out at ~20 MB/s is already quite good for a budget router.
Yes probably you are right. Other file share system like NFS can maybe increase the performance a bit? I Will not use all feature of samba, I think. Isn't NFS lighter CPU wise?
root@XiaomiMiRouter3G:~# time dd if=/dev/zero of=tempfile bs=1M count=102
4
1024+0 records in
1024+0 records out
real 0m 44.69s
user 0m 0.00s
sys 0m 13.37s
root@XiaomiMiRouter3G:~# time dd if=/dev/zero of=tempfile bs=1M count=1024
1024+0 records in
1024+0 records out
real 0m 53.17s
user 0m 0.02s
sys 0m 20.59s
root@XiaomiMiRouter3G:~# time dd if=/dev/zero of=tempfile bs=1M count=1024
1024+0 records in
1024+0 records out
real 0m 51.28s
user 0m 0.02s
sys 0m 20.32s
root@XiaomiMiRouter3G:~# time dd if=/dev/zero of=tempfile bs=1M count=1024
1024+0 records in
1024+0 records out
real 0m 59.99s
user 0m 0.00s
sys 0m 21.00s
This is an interesting benchmark... I'm a LEDE/OpenWRT novice, but I have recently configured my TP-Link Archer c2600 to support USB, but in this instance I have used a NTFS formatted 16GB USB 3.0 thumb drive.
I only use NTFS drives as I require to use the same drive on Windows based systems.