Re: USB I/O performance

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 2009-08-30 at 14:40 -0400, fred smith wrote:
> On Sat, Aug 29, 2009 at 11:52:48PM -0430, Patrick O'Callaghan wrote:
> > Just a quick note to call people's attention to
> > http://marc-abramowitz.com/archives/2007/02/17/getting-good-performance-out-of-usb-hard-drives-in-linux/. This is a couple of years old but it worked like a charm for me.
> > 
> > Briefly, there's a kernel parameter
> > called /sys/block/sd[a,b,...]/device/max_sectors (for USB drives sda,
> > sdb etc.). This specifies the maximum size of a disk I/O operation for
> > USB storage devices in units of 512 bytes, the default value being 240,
> > i.e. 120KB (see http://www.linux-usb.org/FAQ.html#i5). The max_sectors
> > value can be changed doing "echo N > ..." as root, and can have a
> > dramatic effect on write performance for USB devices such as pendrives.
> > 
> > I tested this by writing over 2GB to a fresh VFAT filesystem on a 4GB
> > Kingston Data Traveller pendrive plugged into a USB2 port with the EHCI
> > driver (as indicated by dmesg). With the default setting, this took
> > nearly 90 minutes including a final sync to flush the buffers. Using a
> > max_sectors value of 1024 -- the highest the system would accept -- the
> > time was reduced to under 16 minutes, a better than 5 times speedup.
> > YMMV of course, as different brands of pendrive can have very different
> > performance characteristics.
> > 
> > Note that the value resets to the default when you unplug the drive, so
> > you need to set it manually each time. I don't know if there's a way to
> > do this automatically, or change the default value permanently.
> > 
> > Sorry of everyone already knew this, but I found it so useful I just had
> > to share it :-)
> 
> No, I didn't know it!
> 
> I was just playing with it on F12 on my eeepc 901, using a 1 gig Memorex stick.
> On that hardware I cannot use any value > 1024, or I get:
> 
> 	bash: echo: write error: Invalid argument.
> 
> but copying a 640 meg file takes abouty 4:20 (4 mins, 20 sec) with the
> default setting of 240 and about 40 seconds with it set to 1024. Nice
> speedup.
> 
> With an 8 gig Sandisk Cruzer I get the same error when trying to use a
> value > 1024, so it's not caused by the USB stick, but by some limitation
> in the system (despite what it says in the USB FAQ referenced above about
> there being no kernel limit.)

It turns out that the FAQ is wrong. Perhaps it's out of date.
In /usr/share/doc/kernel-doc-2.6.30.5/Documentation/block/biodoc.txt we
find: "The upper limit of max_sectors is 1024."

poc

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines

[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux