USB I/O performance

Jake Peavy djstunks at gmail.com
Sun Aug 30 04:49:42 UTC 2009


On Sat, Aug 29, 2009 at 10:22 PM, Patrick O'Callaghan <pocallaghan at gmail.com
> 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.<http://fedoraproject.org/wiki/Communicate/MailingListGuidelines>
>


There are probably other ways, but you could create a udev rule to run a
shell script to set the value each time your particular device was plugged:

http://reactivated.net/writing_udev_rules.html#external-run

HTH,
-- 
-jp

If you want to be the most popular person in your class, whenever the
professor pauses in his lecture, just let out a big snort and say "How do
you figger that!" real loud. Then lean back and sort of smirk.

deepthoughtsbyjackhandey.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/fedora-list/attachments/20090829/f996cb04/attachment-0001.htm>


More information about the fedora-list mailing list