# Hard Drive Performance

## Delphiki

Ok, I have a set up like this..

On hda I have a 80 gb 7200 rpm seagate hd.

On hdb I have a 60 gb 5400 rpm maxtor hd.

hdc is a cdrw drive and hdd is a dvd drive.

hdparm -t /dev/hda gives a speed of about 17.5 mb/s

hdparm -t /dev/hdb gives a speed of about 25 mb/s

Both drives have exactly the same options enabled in hdparm, except for the possible exception of which UDMA they use. hdparm can't tell what UDMA the seagate is using, and when I try and set it it doesn't give me any errors, so I assume it works. I have a Shutttle AK31 motherboard, which has a VIA8233 chipset and support for up to udma5. The hard drive that's getting bad performance is a ST380021A which also supports udma5 and I think udma6.

I even tried benchmarking in Windows and it performed at about half what was expected of a drive with it's specs. Is there some way I can figure out why it's working so slowly? I've read about other people getting 40mb/s or more with the exact same drive. I tried disconnecting the second drive and that didn't help.

Does anyone have any ideas? Between this and the fact that no matter what I do Phoenix won't do anything except exit immediately with no output/errors, I'm just about ready to put a brick through my monitor.

----------

## krt

You have several things going here:

1) Are you using an ata-100/133 certified cable (i.e. 80 pin style)?

2) Tweaking with HDPARM might not be the best idea... data corruption can result.  If the speed is acceptable (or about what you'd expect) then I wouldn't bother trying to squeeze and extra half meg a second of throughput from it.  But I prefer stable data, you might not  :Wink: 

3) Your kernel drives might not be optimal.  Insure that you're using the right set of drivers for your chipset.  If you have a CMD 68x series, you can get away with just using the stock CMD 640 drive, but you can also turn on the CMD 68x driver enhancements. 

4) Don't believe everything that you read in the forums in terms of speed, power, efficiency.. some people like to wag their tail..  sure, I could say "my Athlon XP runs at 5 GHZ!" But I might forget to tell you that it only runs for about three seconds, and I have to use a kludgey liquid nitrogen setup to get there.   And then again, I could be at a public library computer, never having run gentoo in my life, and be lying through my teeth  :Smile: 

If so, then your speed issue is directly related to the fact that both hard drives are on the same IDE channel.  In IDE, both devices on the channel share the channel.. and all operations are blocking in nature (the system has to wait for one operation to finish before starting the next task).  So, lets say you want to copy a file from one drive to another...:

you typ e "cp /mount/for/hda/home/delphiki/three.megabyte.file.txt /mount/for/hdb/delphikis.extra.space/"

then this operation is going on, in order, where each operation -must- finish before starting the next (greatly simplified, as you'll see)

find a few bytes of data from /dev/hda

read a few bytes of data from /dev/hda

find the place to write the few bytes of data to /dev/hdb

write the few bytes of data to /dev/hdb

find a few more bytes of data from /dev/hda

read a few more bytes of data from /dev/hda

find the place to write a few more bytes of data to /dev/hdb

write a few more bytes of data to /dev/hdb

if you had each drive on their own channel, the timing greatly changes (I'll use the same example, except that hdb is now hdc):

find a few bytes of data from /dev/hda

read a few bytes of data from /dev/hda

2a.find a place to write a few bytes of data to /dev/hdc

2b. find a few more bytes of data from /dev/hda

3a. write a few bytes of data to /dev/hdc

3b. read a few more bytes of data from /dev/hda

4a. find a place to write a few more bytes of data to /dev/hdc

4b. find even more bytes of data to read from /dev/hda

where each numbered line happens at the same time.

Add in general system overhead (log file writing, swap, etc.) and you can see that using your system disk as your data disk on the same channel will slow things down.. in some cases, to an unusable level of performance (rare these days  :Smile: .

If you only have two ide channels and dont want to upgrade, your best bet is to put the cdrom on the channel opposite of the drive that will be in use the most, or that copies data from it the most.  

The best solution is to purchase a Linux compatible IDE controller for some extra channels (dig through the kernel drives in make menuconfig, see which cards are supported, then read about the card/verify that its a good card, then buy the card)

----------

## Delphiki

1) I'm not sure, how can I check this?

2) The speed is usable, but I've heard multiple people getting twice the benchmark that I'm getting using hdparm, or slightly more.

3) As far as I can tell, my kernel drivers are correct. my motherboard has a VIA8233 chipset and I have VIA82xx enabled in the kernel.

4) I'm just basing it on hdparm -tT which from what I understand is a fairly standard benchmark for hard drive performance.

I understand what you're saying about the drives being on the same ide channel, but like I said, I tried it with one of the drives disconnected and still got lousy performance. Money is pretty tight now so I don't really want to buy an IDE controller right now..

----------

## Malakin

As long as you're using udma4 or better I wouldn't worry about trying to increase it.

"hdparm -i /dev/hda" should show the udma speed it's running at.

If it's definitely using udma4+ and still getting only 17M/sec there might be something physically wrong with the seagate hard drive. You could try their diagnostic software:

http://www.seagate.com/support/seatools/index.html

You could also try a vanilla sources 2.4.20 kernel and see if that makes any difference.

I agree you should be getting a much higher score, I'm using a western digital 80G (non se) drive and getting about 47M/sec. A slower cpu will give you slower results but you should be getting at least 30M/sec even with a low end Duron (I think).

----------

## Delphiki

I'm using an Athlon XP 1800+. Oddly enough hdparm -i /dev/hda says udma6 is "Likely used" but can't tell me for sure. No matter what I set the udma to using hdparm -X /dev/hda it still says Likely used is 6. I've already tried the gentoo kernel and the ck kernel, I might try vanilla next.

I'll try that diagnostic tool though first, thanks.

----------

## Delphiki

Well, the Seagate diagnostic tool turned up nothing and I tried to use the tool they had to set the maximum UDMA which it turns out was already set to 5, but for some reason the system isn't setting the DMA for either that or my second hard drive higher than 2. Would this be because I don't have a proper  ata-100/133 certified cable? And I'm still wondering how I can check whether it is or not.

----------

## PT_LAmb

I have a Pentium4 2GHz system, with a Intel D845 GBV motherboard, 256 MB PC-266 RAM, and a Seagate Barracuda IV (ATA100 7200RPM) 80Gb Disk.

hdparm -i /dev/hdc reports:

```
 Model=ST380021A, FwRev=3.19, SerialNo=3HV22T4Y

 Config={ HardSect NotMFM HdSw>15uSec Fixed DTR>10Mbs RotSpdTol>.5% }

 RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=4

 BuffType=unknown, BuffSize=2048kB, MaxMultSect=16, MultSect=16

 CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=156301488

 IORDY=on/off, tPIO={min:240,w/IORDY:120}, tDMA={min:120,rec:120}

 PIO modes:  pio0 pio1 pio2 pio3 pio4

 DMA modes:  mdma0 mdma1 mdma2

 UDMA modes: udma0 udma1 udma2 udma3 udma4 *udma5

 AdvancedPM=no WriteCache=enabled

 Drive conforms to: device does not report version:  1 2 3 4 5
```

What scares me is the performance:

```
mestserv01 root # hdparm -t /dev/hdc

/dev/hdc:

 Timing buffered disk reads:  64 MB in 22.45 seconds =  2.85 MB/sec

```

Is this acceptable?   :Confused: 

I appreciate any comment,

Ricardo Cordeiro  :Smile: 

----------

## Delphiki

It looks like you don't have dma turned on. Try hdparm -d1 /dev/hdc.

----------

## Malakin

 *Quote:*   

> Would this be because I don't have a proper ata-100/133 certified cable?

 

Cables are either 40 wire or 80 wire, you need the 80 wire to run higher then udma2. It should be obvious from looking at the cable if it's a 40 or an 80, the 40 will look similar to the floppy cable except wider and the wires on the 80 will be much finer then the floppy cable.

Usually the bios will print an error message on boot complaining about the cable if you use a 40 wire cable. Also most diagnostic software will complain about the cable also, although I haven't used seagate's so I can't say about that one in particular.

One of my systems is a P3-800 on a bx motherboard which only supports udma2, I'm still getting 27M/s with it so I doubt that's the problem if you're only getting 17M/s with yours especially with an XP1800. If udma2 was your bottleneck I'd expect you to get 30M/s or something fairly close to the max. I've been wrong before though ;)

----------

## PT_LAmb

 *Delphiki wrote:*   

> It looks like you don't have dma turned on. Try hdparm -d1 /dev/hdc.

 

hi,

```
mestserv01 root # hdparm -d 1 /dev/hdc

/dev/hdc:

 setting using_dma to 1 (on)

 HDIO_SET_DMA failed: Operation not permitted

 using_dma    =  0 (off)
```

It didn't work   :Crying or Very sad: 

What should I do? Do you need more information?

Thanks in Advance,

Ricardo Cordeiro

----------

## Delphiki

The most likely problem is that your ide controller is not properly configured in your kernel. If that is the case, you need to figure out what the IDE controller of your motherboard's chipset is and compile that option into the kernel.

----------

## Delphiki

Yeah... I should've noticed this sooner, but my BIOS complains about not having an 80 pin cable. Now if I can ever find one maybe that will help, maybe not. worth a shot though. Finding one might be a pain though since there aren't any places that would stock that sort of thing around here that I can think of.

----------

## Delphiki

Ok, I picked up a ATA100/133 certified cable, and I'm getting over double the performance out of my Seagate and slightly better performance out of my Maxtor, so I'm happy.. except for that my gentoo system seems to have completely died..

----------

## jmaltais

hd -Tt /dev/hda reports:

~180MB/sec and ~18MB/sec

This seems very slow to me since I have an AMD Tbird-850 and a Gigabyte GA-7ZX.  I have just updated my BIOS and I'm certain I have the right IDE chipset in the kernel.

I know my HD supports UDMA-5 and hdparm reports so.  My pdf manual for my MOBO says it supports UDMA33/ATA66/ATA100.  

Alright, so my BIOS reports UDMA-2 but I'm pretty sure I have the regular ATA/33 IDE cables in my computer.  So do you think that buying new cables will allow me to get the maximum throughput?  Is their something else that would make it go faster?  I think that the rating I'm getting right now is now how it's supposed to be.  :Rolling Eyes: 

 and yes, I have used the optimization flags for hdparm [/b]

----------

## serotonin

i have a segate baracuda 160 gb drive and i get about 50mb/second (native sata interface)

processor is an xp2700+ with 1/2 gb ddr3200 

hdparm -i /dev/hde

/dev/hde:

 Model=ST3160023AS, FwRev=3.18, SerialNo=3JS2E9YT

 Config={ HardSect NotMFM HdSw>15uSec Fixed DTR>10Mbs RotSpdTol>.5% }

 RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=4

 BuffType=unknown, BuffSize=8192kB, MaxMultSect=16, MultSect=16

 CurCHS=65535/1/63, CurSects=4128705, LBA=yes, LBAsects=268435455

 IORDY=on/off, tPIO={min:240,w/IORDY:120}, tDMA={min:120,rec:120}

 PIO modes:  pio0 pio1 pio2 pio3 pio4

 DMA modes:  mdma0 mdma1 mdma2

 UDMA modes: udma0 udma1 udma2

 AdvancedPM=no WriteCache=enabled

 Drive conforms to: ATA/ATAPI-6 T13 1410D revision 2:

 * signifies the current active mode

hdparm -t /dev/hde

/dev/hde:

 Timing buffered disk reads:  152 MB in  3.02 seconds =  50.37 MB/sec

it seems very odd to me that the udma is:

UDMA modes: udma0 udma1 udma2

does this sound right for a sata drive ?

----------

## Malakin

 *Quote:*   

> does this sound right for a sata drive ?

 well your performance is about right. A newer hard drive on a newer system will get about 50MB/s. There is no performance advantage to sata over pata at this time with one drive.

----------

## caenus

Hopefully a simple question that is in line with all the HD performance talk.

When I do hdparm -tT I'm getting approx 418mb/s and 56mb/s

However when I copy large files from one partition to another on the same HD. The file transfer starts around 50mb/sec and then slowly drops to 10-12mb/sec. Any ideas what I could have forgotten to do? I'm running fluxbox and konqueror.

----------

## Malakin

 *Quote:*   

> When I do hdparm -tT I'm getting approx 418mb/s and 56mb/s
> 
> However when I copy large files from one partition to another on the same HD. The file transfer starts around 50mb/sec and then slowly drops to 10-12mb/sec. Any ideas what I could have forgotten to do? I'm running fluxbox and konqueror.

 When you get 56MB/s with hdparm that's your max read speed. When you copy files from partition to partition it includes read time plus write time plus the drive heads have to move between partitions plus file fragmentation may slow things down, writing is quite a bit slower then reading. 10-12MB/s may be just fine, I'm getting a little better then that but probably averaging about 14MB/s on a 500MB file. Also if you're copying from one filesystem to another that can slow things down also.

----------

## caenus

Ok, thanks, makes sense. I did some tests on my Windows machine and it appears to have similar copy times. Just making sure I didn't do anything wrong on my gentoo.

----------

