Tuesday, January 12, 2010

Little USB trick!

I just thought I would drop here a quick trick I learn today, which is specially handy in case you have issues with the speed of your USB pen drive (somewhat of a known issue in Ubuntu).

All hail the great hdparm command!

Well, first off, you need to know which device name your USB drive was mounted under. There are a number of ways to do this, but I find the df command specially convenient. From the command line type:

df

You should see something like this:

/dev/sda1 230582768 7128296 211741484 4% /
udev 1799044 344 1798700 1% /dev
none 1799044 852 1798192 1% /dev/shm
none 1799044 308 1798736 1% /var/run
none 1799044 0 1799044 0% /var/lock
none 1799044 0 1799044 0% /lib/init/rw
/dev/sdc1 976283280 198640624 777642656 21% /media/IomegaHDD
/dev/sdd1 15070264 8 15070256 1% /media/MiniMetal


As you can see from the last line, my device "MiniMetal" was mounted under /dev/sdd1.

Now just type the following:

sudo hdparm -tT /dev/sdd1

After a few seconds, you will get some interesting results:

/dev/sdd1:
Timing cached reads: 6268 MB in 2.00 seconds = 3137.77 MB/sec
Timing buffered disk reads: 94 MB in 3.01 seconds = 31.22 MB/sec


It is recommended to run this command a few times (three at least), with your PC as idle as possible. An average of the three results will give you a very close estimation of your actual speed.

If you own a USB 2.0 drive and are getting timing cached reads below 1500 MB/sec, you probably have issues. As far as I know, there is no permanent fix for such problem, but a working workaround would go as follows (from the command line, sudo may be required):

rmmod ehci_hcd
rmmod uhci_hcd
modprobe ehci_hcd
modprobe uhci_hcd


Hope you found this interesting and useful!

No comments:

Post a Comment