How do I optimize eSATA performance in Linux?

-1

I experience very slow eSATA performance. Around 5 mb/s on a disk that easily handles 150-200 mb/s. Do I need to enable some setting or module in order to speed it up? The disk is a 4 TB disk and the computer is an HP MicroServer. Kernel is 3.2.0-4-amd64.

Update:

Distribution is Debian Lenny.

I have measured using dd if=/dev/zero of=/mnt/foo and if=/mnt/somebigfile.tar.gz of=/dev/null. I have tried various block sizes for dd as well as oflag=direct and iflag=direct.

Both read and write are slow. However, I am most concerned about writes as this disk was supposed to be used for backup...

Update:

I have done some more performance testing with dd. Here are the results:

(root@corvina) (14-08-17 22:40:29) (P:0 L:2) [0]
~ # alias drop-all-caches                         [R0 J0 L:0.70 1.13 1.35 U:3+11:29 pts/4 2122H]
drop-all-caches='sync ; echo 3 > /proc/sys/vm/drop_caches'
(root@corvina) (14-08-17 22:40:39) (P:0 L:2) [0]
~ # hdparm -Tt /dev/sda                           [R0 J0 L:0.60 1.10 1.33 U:3+11:29 pts/4 2123H]

/dev/sda:
 Timing cached reads:   2970 MB in  2.00 seconds = 1484.76 MB/sec
 Timing buffered disk reads: 528 MB in  3.01 seconds = 175.37 MB/sec
(root@corvina) (14-08-17 22:40:59) (P:0 L:2) [0]
~ # drop-all-caches; time dd if=/dev/zero of=/mnt/zero.dat bs=8k count=100k; time sync
102400+0 records in
102400+0 records out
838860800 bytes (839 MB) copied, 1,35067 s, 621 MB/s
dd if=/dev/zero of=/mnt/zero.dat bs=8k count=100k  0,03s user 1,32s system 91% cpu 1,485 total
sync  0,00s user 0,01s system 0% cpu 8,002 total
(root@corvina) (14-08-17 22:41:57) (P:0 L:2) [0]
~ # rm -vf /mnt/zero.dat                          [R0 J0 L:0.57 0.93 1.25 U:3+11:30 pts/4 2125H]
removed `/mnt/zero.dat'
(root@corvina) (14-08-17 22:42:28) (P:0 L:2) [0]
~ # drop-all-caches; time dd if=/dev/zero of=/mnt/zero.dat bs=8k count=1000k; time sync
1024000+0 records in
1024000+0 records out
8388608000 bytes (8,4 GB) copied, 68,5064 s, 122 MB/s
dd if=/dev/zero of=/mnt/zero.dat bs=8k count=1000k  0,41s user 22,31s system 33% cpu 1:08,58 total
sync  0,00s user 0,01s system 0% cpu 14,465 total
(root@corvina) (14-08-17 22:43:52) (P:0 L:2) [0]
~ # drop-all-caches; time dd if=/dev/zero of=/mnt/zero.dat bs=8k count=1000k oflag=direct; time sync
1024000+0 records in
1024000+0 records out
8388608000 bytes (8,4 GB) copied, 184,3 s, 45,5 MB/s
dd if=/dev/zero of=/mnt/zero.dat bs=8k count=1000k oflag=direct  0,79s user 109,24s system 59% cpu 3:04,62 total
sync  0,00s user 0,01s system 2% cpu 0,289 total
(root@corvina) (14-08-17 22:47:59) (P:0 L:2) [0]
~ # drop-all-caches; time dd of=/dev/null if=/mnt/zero.dat                                       16384000+0 records in
16384000+0 records out
8388608000 bytes (8,4 GB) copied, 82,3752 s, 102 MB/s
dd of=/dev/null if=/mnt/zero.dat  8,13s user 33,21s system 50% cpu 1:22,44 total
(root@corvina) (14-08-17 22:49:58) (P:0 L:2) [0]
~ # drop-all-caches; time dd of=/dev/null if=/mnt/zero.dat bs=8k
1024000+0 records in
1024000+0 records out
8388608000 bytes (8,4 GB) copied, 82,0298 s, 102 MB/s
dd of=/dev/null if=/mnt/zero.dat bs=8k  0,76s user 19,02s system 24% cpu 1:22,18 total
(root@corvina) (14-08-17 22:51:31) (P:0 L:2) [0]
~ # drop-all-caches; time dd of=/dev/null if=/mnt/zero.dat bs=8k iflag=direct
1024000+0 records in
1024000+0 records out
8388608000 bytes (8,4 GB) copied, 157,355 s, 53,3 MB/s
dd of=/dev/null if=/mnt/zero.dat bs=8k iflag=direct  0,88s user 85,48s system 54% cpu 2:37,42 total

These numbers do not look like what I got earlier at all. It is pretty late here, so I have to go to sleep. I hope I will be able to investigate this further on Tuesday.

Thomas

Posted 2014-08-15T07:03:26.853

Reputation: 265

You need to include how you measured the throughput for it to be at all meaningful. Did you read or write (their speed are usually very different)? Did you dd if=/dev/random (would be limited to the speed of /dev/random generation)? Did you copy a file from and to the same disk? Did you use some closed source tool which doesn't explain any of its numbers? – l0b0 – 2014-08-15T07:13:48.957

eSATA performance is an issue for a lot of people, so I think this is a relevant question. @Thomas: please provide some more information on your Linux distribution and hardware (the Debina/Ubuntu package lsscsi might come in handy here). – agtoever – 2014-08-15T07:46:29.757

You are testing '/mnt/zero.dat', which is on your root partition (internal hd). Mount your esata first ('sudo mount /dev/sdc /mnt/esatadisk' or use the directory created by the automounter) and then test that disk ('... of=/mnt/esatadisk/zero.dat') – agtoever – 2014-08-18T06:16:37.453

Answers

1

First start by testing your throughput

  • Using the terminal, you can use: sudo hdparm -Tt /dev/sda (where /dev/sda is your disk)
  • To do a write test: dd if=/dev/zero of=/mnt/yourdisk/output.tmp bs=8k count=100k (mount yourdisk at /mnt/yourdisk)
  • And a read test: dd if=/mnt/yourdisk/output.tmp of=/dev/null bs=8k (first create the file using the write test and mount the disk)
  • Also, if you want to use the GUI and you have Gnome, you can use gnome-disks (more info on that project)

Find the weakest link

I prefer to use atop to analyse what's going on on your system and to identify bottle necks. Read/write to the eSATA drive (see above) and at the same time keep a look at atop (press d while running atop to see the disk related information). What's going on there? Can you provide a screenshot?

Improve eSATA performance

Here are some general tips (with the information you provided,I can't be more specific. please provide us some more information on your chain of hardware if you want more specific tips):

  • Getting the right drivers for your (e)SATA hardware
  • Some Linux distributions provide scsitools (project site), which can also be very useful.
  • Does your BIOS have any options for your eSATA port, such as IDE or AHCI mode.

agtoever

Posted 2014-08-15T07:03:26.853

Reputation: 5 490

Added test results. – Thomas – 2014-08-17T21:11:44.880