You are not logged in.

#1 2014-07-22 22:37:35

BennyBolton
Member
From: Christchurch New Zealand
Registered: 2011-10-14
Posts: 63
Website

[SOLVED] USB 2 Slow Writes

I have a external harddisk, the harddisk itself is capable of speeds >100 MB/s (as seen on another machine usb 3), but on my computer, I only get ~10 MB/s write speeds on arch even though the same disk, same port gets ~25 MB/s write speeds on windows. Read is fine at about 30 MB/s which is what I would expect from usb 2
I don't know where to start when it comes to resolving this. I tried googling but only got found results for failing drivers / dealing with usb 2 speeds etc.
Does anyone know why I might be getting slow write speeds or can point me in the right direction?

Edit: I'm running 64 bit version of arch on an acer aspire m1900

Last edited by BennyBolton (2014-07-23 21:18:19)


HP DV6 + Arch + Openbox

Offline

#2 2014-07-22 23:40:17

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,019

Re: [SOLVED] USB 2 Slow Writes

Maybe http://www.tuxera.com/community/ntfs-3g-faq/#slow will give you some ideas.

Offline

#3 2014-07-23 04:09:31

BennyBolton
Member
From: Christchurch New Zealand
Registered: 2011-10-14
Posts: 63
Website

Re: [SOLVED] USB 2 Slow Writes

The speeds I listed as getting in arch are the result of dd (i.e. dd if=/dev/zero of=/dev/sd?...). To fast to be full speed, but to slow (imo) to be high speed. The results are independent of the filesystem


HP DV6 + Arch + Openbox

Offline

#4 2014-07-23 04:34:56

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,019

Re: [SOLVED] USB 2 Slow Writes

Are you using some decent block size, e.g. bs=4096?

Offline

#5 2014-07-23 21:18:04

BennyBolton
Member
From: Christchurch New Zealand
Registered: 2011-10-14
Posts: 63
Website

Re: [SOLVED] USB 2 Slow Writes

hmm...
Running again using the command

dd if=save.img bs=4096 count=250000 of=/dev/sdg1

I get the output (while running watch -n 5 kill -USR1 '`pidof dd`'):

157501+0 records in
157501+0 records out
645124096 bytes (645 MB) copied, 3.94887 s, 163 MB/s
200350+0 records in
200350+0 records out
820633600 bytes (821 MB) copied, 8.95875 s, 91.6 MB/s
240618+0 records in
240618+0 records out
985571328 bytes (986 MB) copied, 13.9754 s, 70.5 MB/s
250000+0 records in
250000+0 records out
1024000000 bytes (1.0 GB) copied, 32.1618 s, 31.8 MB/s
250000+0 records in
250000+0 records out
1024000000 bytes (1.0 GB) copied, 32.1619 s, 31.8 MB/s

No idea why it spikes at the beginning (doesn't do this with bs=512) , but the gap in between the following prints show the expected ~30 MB/s, and still stranger, when re-mounting and using dd to copy a file, I get ~10 MB/s with bs=512, but suprisingly ~50 MB/s with bs=4096. If anyone can think of a reason for this behaviour I would be interested to know

Anyways, thanks for the heads up lucke, marking as solved


HP DV6 + Arch + Openbox

Offline

#6 2014-07-24 00:24:36

RankoKohime
Member
Registered: 2014-01-08
Posts: 87
Website

Re: [SOLVED] USB 2 Slow Writes

The behaviour stems from the way DD works.  I couldn't tell you exactly where the slowdown is, but lower block sizes cause more I/O overhead traffic.  As for the higher speeds at the beginning, that's the effect of write caching.  I'm not sure why write caching is turned on for external drives, though.

Offline

#7 2014-07-24 00:49:25

anatolik
Developer
Registered: 2012-09-27
Posts: 458

Re: [SOLVED] USB 2 Slow Writes

> why write caching is turned on for external drives

Caching (in kernel it is called buffer caching) is enabled for all block devices. If you don't want it then use Direct I/O, dd allows to do it with oflag=direct

And of course using smaller write blocks is more expensive as you spend more time on setting I/O operations, on syscall overhead etc...


Read it before posting http://www.catb.org/esr/faqs/smart-questions.html
Ruby gems repository done right https://bbs.archlinux.org/viewtopic.php?id=182729
Fast initramfs generator with security in mind https://wiki.archlinux.org/index.php/Booster

Offline

Board footer

Powered by FluxBB