# Hardrive performance question

## StarDragon

Is there anyway to improve hardrive performance? I've noticed when I write BIG stuff to the hd my systems performance gets to be very slow. Please, any sugestions would be apreciated.

----------

## NeddySeagoon

StarDragon,

Tell us how your drives (all of them) are connected. If they are IDE run

```
hdparm -tT /dev/<drive>

hdparm /dev/<drive>
```

and post the results.

----------

## widan

Maybe your drive is working in PIO mode, instead of UDMA. You can check that using hdparm:

```
stephanie ~ # hdparm -i /dev/hda

/dev/hda:

 Model=MAXTOR 6L080J4, FwRev=A93.0500, SerialNo=664207615174

 Config={ HardSect NotMFM HdSw>15uSec Fixed DTR>10Mbs }

 RawCHS=16383/16/63, TrkSize=32256, SectSize=21298, ECCbytes=4

 BuffType=DualPortCache, BuffSize=1819kB, MaxMultSect=16, MultSect=16

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

 IORDY=on/off, tPIO={min:120,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 udma6

 AdvancedPM=no WriteCache=enabled

 Drive conforms to: ATA/ATAPI-5 T13 1321D revision 1:

 * signifies the current active mode
```

The star should be on one of the UDMA modes (the exact one depends on both drive and chipset capabilities, in my example it is an old motherboard that can't handle the faster modes).

If the current mode is a PIO mode, try to enable DMA:

```
hdparm -d 1 /dev/hda
```

To test performance, you can use:

```
hdparm -tT /dev/hda
```

----------

## Gentree

vite sur ebay!

http://cgi.ebay.fr/ws/eBayISAPI.dll?ViewItem&category=3753&item=5211606434&rd=1&ssPageName=WDVW

enchers a 10 euros il reste 12h!

If not there are often pci ide controller cards for very little, they're as old a your mobo!!

HTH  :Cool: 

----------

## StarDragon

It is in the correct DMA mode, here is what I get when I run the performance checker:

leamonde linux # hdparm -i /dev/hda

/dev/hda:

 Model=QUANTUM FIREBALLP AS30.0, FwRev=A1Y.1300, SerialNo=193101434042

 Config={ HardSect NotMFM HdSw>15uSec Fixed DTR>10Mbs }

 RawCHS=16383/16/63, TrkSize=32256, SectSize=21298, ECCbytes=4

 BuffType=DualPortCache, BuffSize=1902kB, MaxMultSect=16, MultSect=16

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

 IORDY=on/off, tPIO={min:120,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: ATA/ATAPI-5 T13 1321D revision 1:

 * signifies the current active mode

leamonde linux # hdparm -tT /dev/hda

/dev/hda:

 Timing cached reads:   916 MB in  2.07 seconds = 442.58 MB/sec

 Timing buffered disk reads:   16 MB in  3.37 seconds =   4.74 MB/sec

leamonde linux # hdparm /dev/hda

/dev/hda:

 multcount    = 16 (on)

 IO_support   =  0 (default 16-bit)

 unmaskirq    =  0 (off)

 using_dma    =  0 (off)

 keepsettings =  0 (off)

 readonly     =  0 (off)

 readahead    = 256 (on)

 geometry     = 58168/16/63, sectors = 30020272128, start = 0

leamonde linux #

Maybe I can do something to tweak these parameters, any help would be appreciated as ebuilds are chewing up all the performance of this system.

----------

## 96140

 *StarDragon wrote:*   

> 
> 
>  UDMA modes: udma0 udma1 udma2 udma3 udma4 *udma5
> 
> /dev/hda:
> ...

 

In fact, you're not using DMA at all. Look at the output that I put in bold. You have a modern drive that supports UDMA5, so let's take advantage of that. Let's try a safe performance-enhancing boost to unlock the full potential of your drive, with statistics before and afterward to show the difference:

```
# hdparm -tT /dev/hda

# hdparm -a256A1c1d1m16u1 /dev/hda

# hdparm -tT /dev/hda
```

Assuming that we've now greatly sped up your drive, you'll need to save your hdparm settings; your config file should like something like this:

```
# nano /etc/conf.d/hdparm

hda_args="-a256A1c1d1u1m16"
```

----------

## Gentree

read man hdparm , esp the diff between -i and -I , it's a case of _when_ that info was current.

There is a kernel option under ATA/ATAPI.... like : USE DMA WHEN AVAILABLE, make sure it's not off.

I get the following from my 120G Seagate with and 8M buffer

```
/dev/hda:

 Timing cached reads:   1284 MB in  2.00 seconds = 640.82 MB/sec

 Timing buffered disk reads:  164 MB in  3.01 seconds =  54.44 MB/sec

bash-3.00#hdparm  /dev/hda

/dev/hda:

 multcount    = 16 (on)

 IO_support   =  1 (32-bit)

 unmaskirq    =  1 (on)

 using_dma    =  1 (on)

 keepsettings =  0 (off)

 readonly     =  0 (off)

 readahead    = 256 (on)

 geometry     = 16383/255/63, sectors = 120034123776, start = 0

bash-3.00#hdparm  -I /dev/hda

```

I dont use  /etc/conf.d/hdparm , just make sure there is nothing in there resetting DMA or maybe a slower DMA rated device on the cable.

HTH

 :Cool: 

----------

## StarDragon

Hmm... It's not letting me switch over to DMA mode:

leamonde linux # hdparm -a256A1c1d1m16u1 /dev/hda

/dev/hda:

 setting fs readahead to 256

 setting 32-bit IO_support flag to 1

 setting multcount to 16

 setting unmaskirq to 1 (on)

 setting using_dma to 1 (on)

 HDIO_SET_DMA failed: Operation not permitted

 setting drive read-lookahead to 1 (on)

 multcount    = 16 (on)

 IO_support   =  1 (32-bit)

 unmaskirq    =  1 (on)

 using_dma    =  0 (off)

 readahead    = 256 (on)

leamonde linux #

----------

## StarDragon

BTW, I made sure the DMA has not been disabled in the kernel.

----------

## widan

Also check you have selected support for your chipset in the ATA section of the kernel. For example nForce chipsets won't do DMA unless the specific support is selected.

----------

## Gentree

previous post notwithstanding, try comparing you config to mine:

```
zcat /proc/config.gz |grep -i "dma"

CONFIG_GENERIC_ISA_DMA=y

CONFIG_BLK_DEV_IDEDMA_PCI=y

# CONFIG_BLK_DEV_IDEDMA_FORCED is not set

CONFIG_IDEDMA_PCI_AUTO=y

# CONFIG_IDEDMA_ONLYDISK is not set

CONFIG_BLK_DEV_IDEDMA=y

# CONFIG_IDEDMA_IVB is not set

CONFIG_IDEDMA_AUTO=y

```

 :Cool: 

----------

## NeddySeagoon

StarDragon,

You need to compile support for your IDE chipset into the kernel. It needs that to know how your particular chipset works.

Use lspci (emerge pciutils) to identify your chipset, then choose support for it in the list under  *Quote:*   

> Generic PCI bus-master DMA support

 in the kernel configuration. Rebuild and reinstall your kernel. You must not make this a module.

You should see something like a 10x improvement id data transfer speed when it works.

----------

## StarDragon

Awesome, score one for the open source community. The system seems alot faster now, in fact I'm holding my hads up as I'm typing (it's flying!!!!!). Strange how this is not mentioned in the documentation, I really whish it was as I'm sure lots of plp are having the same issue. I've been a linux user for over 3 years now and never realized there was a chipset that had to be set, altough this is the first time I have installed a Gentoo desktop from scratch.  :Embarassed: 

Anyway, I'm wondering. Does the hdparm set parameters to speed up performance on the dvd or cdrom device? When I run this, it goes:

leamonde camilo # hdparm -Tt /dev/hdd

/dev/hdd:

read() failed: Input/output error

 Timing buffered disk reads:  read() failed: Input/output error

leamonde camilo #

Thanks for the help guys, and may the force be with you...  :Wink: 

----------

## NeddySeagoon

StarDragon,

It looks like you don't have a disk in the drive.

If DMA came up on boot for your HDD, provided your DVD is on the same chipset, it will be enabled for the DVD too.

----------

## Gentree

```
# CONFIG_IDEDMA_ONLYDISK is not set
```

check what I posted, you will need that off as I indicate o/w only the disk will get DMA.

Do a forum search , I posted loads of stuff about this a few months back the whole subject got a thorough thrashing. It was primarily about DMA on CDROM drives and ripping speeds if I recall. 

hdparm can only work for IDE , not SCSI.

Again you should not need  configure /etc/conf.d/hdparm to run hdparm on boot once you have the kernel set up correctly.

 :Cool: 

----------

