# disks access is very slow

## edbch

Hello everyone

The basic problem is that access the disk on my gentoo box is very slow.

History

I have a gentoo box, a pentium-mmx, which was installed 4 years ago with profile=server.

He had two ide disks, one with 20GB  and another with 120GB.

This server never haved a decent disc access speed, and the  hdparm never show more of 15MB/s.

Recently I buy a sata raid pci controller, I removed the 20GB disk, put  a sata2 of 160GB, even using the ide of 120GB, but now this new controller. It has two doors, two sata and one ide.

The speed has not improved. I decided install from scratch.

How is today

The system I compiled from stage1 hardened, and with due profile.

```
TiTan ~ # ls -FGg /etc/make.profile

lrwxrwxrwx 1 40 Mar 6 00:59 /etc/make.profile -> ../usr/portage/profiles/hardened/x86/2.6/
```

This is what I have on my system:

```
TiTan ~ # lspci

00:00.0 Host bridge: Silicon Integrated Systems [SiS] 5597 [SiS5582] (rev 02)

00:01.0 ISA bridge: Silicon Integrated Systems [SiS] SiS85C503/5513 (LPC Bridge) (rev 01)

00:01.1 IDE interface: Silicon Integrated Systems [SiS] 5513 [IDE] (rev d0)

00:01.2 USB Controller: Silicon Integrated Systems [SiS] USB 1.0 Controller (rev 10)

00:0b.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8139/8139C/8139C+ (rev 10)

00:0d.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8139/8139C/8139C+ (rev 10)

00:0f.0 RAID bus controller: VIA Technologies, Inc. VT6421 IDE RAID Controller (rev 50)

00:14.0 VGA compatible controller: Silicon Integrated Systems [SiS] 5597/5598/6326 VGA (rev 65)
```

and the sata controller is

```
VIA Technologies, Inc. VT6421 IDE RAID Controller (rev 50)
```

The memory

```
TiTan ~ # free

             total       used       free     shared    buffers     cached

Mem:        120236      84032      36204          0      18072      40048

-/+ buffers/cache:      25912      94324

Swap:      1052248        176    1052072

```

The processor

```
TiTan ~ # cat /proc/cpuinfo           

processor       : 0

vendor_id       : GenuineIntel

cpu family      : 5

model           : 4

model name      : Pentium MMX

stepping        : 3

cpu MHz         : 233.860

cache size      : 0 KB

fdiv_bug        : no

hlt_bug         : no

f00f_bug        : no

coma_bug        : no

fpu             : yes

fpu_exception   : yes

cpuid level     : 1

wp              : yes

flags           : fpu vme de pse tsc msr mce cx8 mmx

bogomips        : 468.32

clflush size    : 32

```

The make.conf

```
TiTan ~ # cat /etc/make.conf

CFLAGS="-march=pentium-mmx -O3 -pipe -fomit-frame-pointer"

CXXFLAGS="${CFLAGS}"

CHOST="i586-pc-linux-gnu"

MAKEOPTS="-j1"

GENTOO_MIRRORS="http://www.las.ic.unicamp.br/pub/gentoo/ "

SYNC="rsync://rsync.samerica.gentoo.org/gentoo-portage"

USE="-gtk -gnome qt kde dvd alsa cdr fpu vme de pse tsc msr mce cx8 mmx up"

#ACCEPT_KEYWORDS="~x86"
```

The disks 

```
TiTan ~ # sfdisk -l

Disk /dev/sda: 19457 cylinders, 255 heads, 63 sectors/track

Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0

   Device Boot Start     End   #cyls    #blocks   Id  System

/dev/sda1          0+     18      19-    152586   83  Linux

/dev/sda2         19     149     131    1052257+  82  Linux swap / Solaris

/dev/sda3        150    2699    2550   20482875   83  Linux

/dev/sda4       2700   19456   16757  134600602+  83  Linux

Disk /dev/sdb: 14593 cylinders, 255 heads, 63 sectors/track

Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0

   Device Boot Start     End   #cyls    #blocks   Id  System

/dev/sdb1       2550   14461   11912   95683140   83  Linux

/dev/sdb2      14462   14592     131    1052257+  82  Linux swap / Solaris

/dev/sdb3         13    2549    2537   20378452+  83  Linux

/dev/sdb4   *      0+     12      13-    104391   83  Linux

```

The sda is the new sata. The sdb is the old ide 120GB. Anyone know why its appears as sata (or scsi )????

hdpar on the old ide and the new sata return:

```
TiTan ~ # hdparm -tT /dev/sdb

/dev/sdb:

 Timing cached reads:    22 MB in  2.01 seconds =  10.93 MB/sec

 Timing buffered disk reads:   18 MB in  3.02 seconds =   5.95 MB/sec
```

```
TiTan ~ # hdparm -I /dev/sdb

/dev/sdb:

ATA device, with non-removable media

        Model Number:       ST3120022A                             

        Serial Number:      5JT097TT           

        Firmware Revision:  3.06   

Standards:

        Used: ATA/ATAPI-6 T13 1410D revision 2

        Supported: 6 5 4

Configuration:

        Logical         max     current

        cylinders       16383   16383

        heads           16      16

        sectors/track   63      63

        --

        CHS current addressable sectors:   16514064

        LBA    user addressable sectors:  234441648

        LBA48  user addressable sectors:  234441648

        device size with M = 1024*1024:      114473 MBytes

        device size with M = 1000*1000:      120034 MBytes (120 GB)

Capabilities:

        LBA, IORDY(can be disabled)

        Standby timer values: spec'd by Standard

        R/W multiple sector transfer: Max = 16  Current = 16

        Recommended acoustic management value: 128, current value: 0

        DMA: mdma0 mdma1 mdma2 udma0 udma1 *udma2 udma3 udma4 udma5

             Cycle time: min=120ns recommended=120ns

        PIO: pio0 pio1 pio2 pio3 pio4

             Cycle time: no flow control=240ns  IORDY flow control=120ns

Commands/features:

        Enabled Supported:

           *    SMART feature set

                Security Mode feature set

           *    Power Management feature set

           *    Write cache

           *    Look-ahead

           *    Host Protected Area feature set

           *    WRITE_BUFFER command

           *    READ_BUFFER command

           *    DOWNLOAD_MICROCODE

                SET_MAX security extension

           *    48-bit Address feature set

           *    Device Configuration Overlay feature set

           *    Mandatory FLUSH_CACHE

           *    FLUSH_CACHE_EXT

           *    SMART error logging

           *    SMART self-test

Security:

                supported

        not     enabled

        not     locked

                frozen

        not     expired: security count

        not     supported: enhanced erase

HW reset results:

        CBLID- above Vih

        Device num = 1 determined by the jumper

Checksum: correct

```

```
TiTan ~ # hdparm -tT /dev/sda

/dev/sda:

 Timing cached reads:    22 MB in  2.01 seconds =  10.93 MB/sec

 Timing buffered disk reads:   10 MB in  3.67 seconds =   2.72 MB/sec

```

```
TiTan ~ # hdparm -I /dev/sda

/dev/sda:

ATA device, with non-removable media

        Model Number:       ST3160811AS                             

        Serial Number:      5PT08YP8

        Firmware Revision:  3.AAE   

Standards:

        Supported: 7 6 5 4

        Likely used: 7

Configuration:

        Logical         max     current

        cylinders       16383   16383

        heads           16      16

        sectors/track   63      63

        --

        CHS current addressable sectors:   16514064

        LBA    user addressable sectors:  268435455

        LBA48  user addressable sectors:  312579695

        device size with M = 1024*1024:      152626 MBytes

        device size with M = 1000*1000:      160040 MBytes (160 GB)

Capabilities:

        LBA, IORDY(can be disabled)

        Queue depth: 32

        Standby timer values: spec'd by Standard, no device specific minimum

        R/W multiple sector transfer: Max = 16  Current = 16

        Recommended acoustic management value: 208, current value: 0

        DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 udma5 *udma6

             Cycle time: min=120ns recommended=120ns

        PIO: pio0 pio1 pio2 pio3 pio4

             Cycle time: no flow control=120ns  IORDY flow control=120ns

Commands/features:

        Enabled Supported:

           *    SMART feature set

                Security Mode feature set

           *    Power Management feature set

           *    Write cache

           *    Look-ahead

           *    Host Protected Area feature set

           *    WRITE_BUFFER command

           *    READ_BUFFER command

           *    DOWNLOAD_MICROCODE

                SET_MAX security extension

           *    48-bit Address feature set

           *    Device Configuration Overlay feature set

          *    Mandatory FLUSH_CACHE

           *    FLUSH_CACHE_EXT

           *    SMART error logging

           *    SMART self-test

           *    General Purpose Logging feature set

           *    SATA-I signaling speed (1.5Gb/s)

           *    Native Command Queueing (NCQ)

           *    Phy event counters

                Device-initiated interface power management

           *    Software settings preservation

Security:

        Master password revision code = 65534

                supported

        not     enabled

        not     locked

                frozen

        not     expired: security count

        not     supported: enhanced erase

Checksum: correct 
```

I do not know very well use sdparm. Please help me. I tried find sdparm manuals, but had no jurisdiction to find a decent.

Also not sure whether the problem is with the sdparm.

Thank you now.

Eduardo.

----------

## SiberianSniper

Make sure your specific SATA controller is enabled in your kernel (under Device Drivers->Serial ATA)  - I once had the problem of really slow drives on my computer and once I compiled in the right IDE controller support, the speed tripled.

Just a thought....

----------

## eccerr0r

Your buffer cache reads is really low.  This is from my 166MHz P5-MMX's onboard PATA through PIIX3 (DMA16.6) to a Seagate UDMA33 6.4GB hard drive:

```
 Timing buffer-cache reads:   164 MB in  2.02 seconds =  81.26 MB/sec

 Timing buffered disk reads:   32 MB in  3.10 seconds =  10.34 MB/sec
```

I'd try taking out 64MB RAM if you had an old FX motherboard.  I'm not sure what other boards that cannot cache memory if you have more than 64MB RAM.  This board I'm using in this P5-mmx is using an HX chipset and to cache more than 64MB RAM I have to use writethrough cache, which isn't optimal but better than cache disabled.  I have 64MB on this board so I can use writeback cache.

Also check to make sure L2 is even enabled in firmware, or if it even has L2 cache...  Some p5 boards are so crappy they don't come with cache.

(yes, my /proc/cpuinfo says 0K cache too, but it's enabled...)

----------

## solamour

I also have a similar configuration (i.e. an old Pentium with VT6421 controller card that has both SATA and PATA). Both SATA and PATA didn't work at first, but when I lowered the SATA disk from SATAII (3GB/s) to SATA (1.5GB/s), at least I'm able to use the SATA disk.

But no matter what I tried, nothing is visible on PATA. I'd appreciate any help. Thank you.

__

sol

----------

## elmie

lots of controllers are CPU dependant, meaning they uses CPU resources. and if you have slow CPU, disk access can be slow (hence.. back in the old days when ya flogging your HDD your PC freezes for a few sec). More ram should help. like the above post make sure you have the right controller built into your kernel too.

Also use resierfs filesystem, they are really fast, if ya arent holding large file size, like movie size files.

----------

