# SATA performance tuning

## crowbert

I have two drives, and I'm getting better behaviour from my older PATA drive than my newer SATA drive.  (This is causing glitches when recording HDTV with MythTV, only when using the SATA drive.)  I'm running vanilla 2.6.14.

The PATA drive is 200GB (WDC WD2000JB-75DUA0).  I'm running it with 

```
hdparm -d1 -m16 -a16 -A1 -u1
```

For SATA, the drive is a 400GB Seagate.  I don't seem to be able to set anything interesting with hdparm.

On a run of 20 'hdparm -t' tests 

```
for ((X=0;X<20;++X)); do hdparm -t /dev/sda | grep Timing | awk '{print $(NF-1)}' ; done | awk '{T+=$1;print $1, T/NR}'
```

 I get 21.5925 MB/s for the PATA drive and 44. 386 MB/s for the SATA drive.  So it looks like the SATA drive is getting better throughput.  However I'm getting lost data from my HD tuner cards when writing to the SATA disk, but not if I write to the PATA disk.  The key to getting the PATA drive to work was setting 

```
hdparm -m16
```

 so I'm wondering if I'm missing some tuning with SATA that would let it behave better.  Setting -m0 on the PATA drive doesn't seem to slow it down, but makes a huge difference in my DVB recordings.  I seem to need a way to similarly tune my SATA drive.

----------

## sargek

It is my understanding that hdparm is not designed at all for SATA drives, and will not give accurate results. Can anyone else confirm this?

----------

## lbrtuk

 *sargek wrote:*   

> It is my understanding that hdparm is not designed at all for SATA drives, and will not give accurate results. Can anyone else confirm this?

 

Yes. But I think he knows that.

----------

## crowbert

 *lbrtuk wrote:*   

> Yes. But I think he knows that.

 

Right.  The point is that it appears that I need to do similar tuning on my SATA drive to what I can do with hdparm on my PATA drive, but I don't have a tool that can do that.

I may look in the kernel code to see if there's a way to hack some of these parameters.

----------

## /carlito

Have you tried sdparm? It's in portage!

----------

## crowbert

I didn't know about sdparm.  Thanks!

Unfortunately, the ATAPI pass-through isn't implemented yet in 2.6.14, which limits its usefulness.  Also, I'm rather mystified by most of the options, so I don't have much of a clue as to what I should try changing.

One thing that I've found with Googling around is that my controller chipset isn't very good:  http://linux.yyz.us/sata/sata-status.html#sii311x "Summary: No TCQ/NCQ. Looks like a PATA controller, but with full SATA control including hotplug and PM."  Looks like I should get a better controller if I want to improve performance.

----------

