Re: USB I/O performance



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.

This has been discussed in other groups, and the issue seems to be that a write to flash time is described as a constant value plus a size dependent value, and that by doing fewer and larger writes the penalty of the constant is less, since it is incurred less often.

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 :-)

I found that it made essentially no difference in read speed (4300k/s vs 4400k/s) so people should be sure they note that "write" is specified in the above 1st paragraph, don't overlook it!

Didn't seem to do much for write speed on a USB connected hard drive, so the significant benefit seems limited to write to flash. That's important, but for many uses there are far more reads than writes.

HINT:I wish it were a standard feature of install to a flash drive. Manually setting it during install is probably worth trying. Any FC11 developers reading this? HINT!!

--
Bill Davidsen <davidsen@xxxxxxx>
"We have more to fear from the bungling of the incompetent than from
the machinations of the wicked." - from Slashdot

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



Relevant Pages

  • Re: Unrecognizible USB, Flash Drives, & Cameras
    ... use any USB storage devices (zip, flash drives or cameras) - all USB drives are no longer recognized. ... This is with no USB flash stick plugged in. ...
    (microsoft.public.windowsxp.hardware)
  • Re: Lifetime of flash memory
    ... FILE ON USB MEMORY" have come out of this. ... and overuse may wear out your memory stick pretty quickly. ... Do _not_ use journalling filesystems on flash memory sticks.) ...
    (Linux-Kernel)
  • Re: Internal USB flash card reader problem
    ... >> happened) I lost the function of my internal USB flash 9-1 card reader. ... >> I tried another internal flash card reader and it does the same thing... ... I noticed a USB driver called USBHS DFU ...
    (microsoft.public.windowsxp.hardware)
  • Re: [SLE] setting the mount option for USB flash
    ... I've noticed that there was no entry for my ... USB flash when I plugged it into my system. ... In FC4, I can control the mount options by modifying fstab, but if I add ... I wonder how SuSE choose the mount options when it auto-mounts USB ...
    (SuSE)
  • Installing FreeBSD from USB flash drive - some experiments
    ... It seems like questions about installing FreeBSD from a USB drive ... With the low price of flash drives these days, ... AFAICT the release ISOs don't currently mount the media ... So how can you direct it to install from the USB media? ...
    (freebsd-stable)