<div class="gmail_quote">On Sat, Aug 29, 2009 at 10:22 PM, Patrick O'Callaghan <span dir="ltr"><<a href="mailto:pocallaghan@gmail.com" target="_blank">pocallaghan@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

Just a quick note to call people's attention to<br>
<a href="http://marc-abramowitz.com/archives/2007/02/17/getting-good-performance-out-of-usb-hard-drives-in-linux/" target="_blank">http://marc-abramowitz.com/archives/2007/02/17/getting-good-performance-out-of-usb-hard-drives-in-linux/</a>. This is a couple of years old but it worked like a charm for me.<br>


<br>
Briefly, there's a kernel parameter<br>
called /sys/block/sd[a,b,...]/device/max_sectors (for USB drives sda,<br>
sdb etc.). This specifies the maximum size of a disk I/O operation for<br>
USB storage devices in units of 512 bytes, the default value being 240,<br>
i.e. 120KB (see <a href="http://www.linux-usb.org/FAQ.html#i5" target="_blank">http://www.linux-usb.org/FAQ.html#i5</a>). The max_sectors<br>
value can be changed doing "echo N > ..." as root, and can have a<br>
dramatic effect on write performance for USB devices such as pendrives.<br>
<br>
I tested this by writing over 2GB to a fresh VFAT filesystem on a 4GB<br>
Kingston Data Traveller pendrive plugged into a USB2 port with the EHCI<br>
driver (as indicated by dmesg). With the default setting, this took<br>
nearly 90 minutes including a final sync to flush the buffers. Using a<br>
max_sectors value of 1024 -- the highest the system would accept -- the<br>
time was reduced to under 16 minutes, a better than 5 times speedup.<br>
YMMV of course, as different brands of pendrive can have very different<br>
performance characteristics.<br>
<br>
Note that the value resets to the default when you unplug the drive, so<br>
you need to set it manually each time. I don't know if there's a way to<br>
do this automatically, or change the default value permanently.<font color="#888888"><a href="http://fedoraproject.org/wiki/Communicate/MailingListGuidelines" target="_blank"></a><br>
</font></blockquote></div><br><br>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: <br><br><a href="http://reactivated.net/writing_udev_rules.html#external-run" target="_blank">http://reactivated.net/writing_udev_rules.html#external-run</a><br>

<br>HTH,<br>-- <br>-jp<br><br>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.<br><br><a href="http://deepthoughtsbyjackhandey.com">deepthoughtsbyjackhandey.com</a><br><br>