# Slow hard disk [Solved / Non-Issue now]

## ppurka

[Solved/Non-Issue now]: I reformatted the hard drive by first overwriting it with zeros and then formatting it to ext3 using gparted from ubuntu-10.04 livecd. Now, after having installed ubuntu-10.04 in it, the speeds are back to what they should be: ~45MB/sec.

At present I do not have an explanation for the weird behaviour of this hard disk before the reformatting. The only explanation I can think of is that the hard disk somehow wasn't properly formatted into ext3 during the previous (gentoo) installation. I can't think of any other factor since the performance was in the 20s earlier (before this reformatting) even from a livecd, so that rules out  misconfigured kernels in gentoo.

What could be the reason for a slow SATA hard disk? Here is some information about the hard disk. 

```
~> hdparm -tT /dev/sda

/dev/sda:

 Timing cached reads:   1030 MB in  2.00 seconds = 514.29 MB/sec

 Timing buffered disk reads:   74 MB in  3.10 seconds =  23.87 MB/sec

~> hdparm -tT /dev/sda

/dev/sda:

 Timing cached reads:   1008 MB in  2.00 seconds = 503.30 MB/sec

 Timing buffered disk reads:   60 MB in  3.02 seconds =  19.90 MB/sec

~> hdparm -i /dev/sda

/dev/sda:

 Model=ST380013AS, FwRev=3.18, SerialNo=3JV9X2RF

 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=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 udma6 

 AdvancedPM=no WriteCache=enabled

 Drive conforms to: ATA/ATAPI-6 T13 1410D revision 2:  ATA/ATAPI-1,2,3,4,5,6

 * signifies the current active mode

~> smartctl --all /dev/sda

smartctl version 5.38 [i686-pc-linux-gnu] Copyright (C) 2002-8 Bruce Allen

Home page is http://smartmontools.sourceforge.net/

=== START OF INFORMATION SECTION ===

Model Family:     Seagate Barracuda 7200.7 and 7200.7 Plus family

Device Model:     ST380013AS

Serial Number:    3JV9X2RF

Firmware Version: 3.18

User Capacity:    80,026,361,856 bytes

Device is:        In smartctl database [for details use: -P show]

ATA Version is:   6

ATA Standard is:  ATA/ATAPI-6 T13 1410D revision 2

Local Time is:    Mon Jan 11 13:59:04 2010 EST

SMART support is: Available - device has SMART capability.

SMART support is: Enabled

=== START OF READ SMART DATA SECTION ===

SMART overall-health self-assessment test result: PASSED

General SMART Values:

Offline data collection status:  (0x82)   Offline data collection activity

               was completed without error.

               Auto Offline Data Collection: Enabled.

Self-test execution status:      (   0)   The previous self-test routine completed

               without error or no self-test has ever 

               been run.

Total time to complete Offline 

data collection:        ( 430) seconds.

Offline data collection

capabilities:           (0x5b) SMART execute Offline immediate.

               Auto Offline data collection on/off support.

               Suspend Offline collection upon new

               command.

               Offline surface scan supported.

               Self-test supported.

               No Conveyance Self-test supported.

               Selective Self-test supported.

SMART capabilities:            (0x0003)   Saves SMART data before entering

               power-saving mode.

               Supports SMART auto save timer.

Error logging capability:        (0x01)   Error logging supported.

               No General Purpose Logging support.

Short self-test routine 

recommended polling time:     (   1) minutes.

Extended self-test routine

recommended polling time:     (  58) minutes.

SMART Attributes Data Structure revision number: 10

Vendor Specific SMART Attributes with Thresholds:

ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE

  1 Raw_Read_Error_Rate     0x000f   050   046   006    Pre-fail  Always       -       66633979

  3 Spin_Up_Time            0x0003   098   098   000    Pre-fail  Always       -       0

  4 Start_Stop_Count        0x0032   100   100   020    Old_age   Always       -       1

  5 Reallocated_Sector_Ct   0x0033   100   100   036    Pre-fail  Always       -       0

  7 Seek_Error_Rate         0x000f   086   060   030    Pre-fail  Always       -       458077803

  9 Power_On_Hours          0x0032   058   058   000    Old_age   Always       -       37424

 10 Spin_Retry_Count        0x0013   100   100   097    Pre-fail  Always       -       0

 12 Power_Cycle_Count       0x0032   100   100   020    Old_age   Always       -       196

194 Temperature_Celsius     0x0022   044   048   000    Old_age   Always       -       44

195 Hardware_ECC_Recovered  0x001a   050   046   000    Old_age   Always       -       66633979

197 Current_Pending_Sector  0x0012   100   100   000    Old_age   Always       -       0

198 Offline_Uncorrectable   0x0010   100   100   000    Old_age   Offline      -       0

199 UDMA_CRC_Error_Count    0x003e   200   200   000    Old_age   Always       -       0

200 Multi_Zone_Error_Rate   0x0000   100   253   000    Old_age   Offline      -       0

202 TA_Increase_Count       0x0032   100   253   000    Old_age   Always       -       0

SMART Error Log Version: 1

No Errors Logged

SMART Self-test log structure revision number 1

Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error

# 1  Extended offline    Completed without error       00%     37229         -

# 2  Short offline       Completed without error       00%     37223         -

# 3  Extended offline    Completed without error       00%     28139         -

# 4  Short offline       Completed without error       00%     26485         -

SMART Selective self-test log data structure revision number 1

 SPAN  MIN_LBA  MAX_LBA  CURRENT_TEST_STATUS

    1        0        0  Not_testing

    2        0        0  Not_testing

    3        0        0  Not_testing

    4        0        0  Not_testing

    5        0        0  Not_testing

Selective self-test flags (0x0):

  After scanning selected spans, do NOT read-scan remainder of disk.

If Selective self-test is pending on power-up, resume after 0 minute delay.

```

Salient points:This hard disk used to give me speeds in mid-40s (MB/s). I have tried kernels from 2.6.30 to 2.6.32, and also 2.6.32-zen4 but the performance is similar. It doesn't depend much on the scheduler (at most 2MB/s difference). In general, the speed varies wildly from around 10MB/s to 40MB/s, but it usually stays around 25MB/s. As you can see from the smartctl data above, I ran a long health test a couple of days ago, and it completed without error. 

Some information about my kernel:

```
~> zgrep -i ata /proc/config.gz|grep -v ^#

CONFIG_X86_MCE_NONFATAL=y

CONFIG_ATA=y

CONFIG_ATA_ACPI=y

CONFIG_ATA_SFF=y

CONFIG_SATA_SIL=y

CONFIG_PATA_ACPI=y

CONFIG_PATA_AMD=y

CONFIG_ATA_GENERIC=y

```

EDIT: Modified a paragraph to change the rambling into a more coherent, readable list of points   :Rolling Eyes: 

----------

## sera

You might want to join the thread at

https://forums.gentoo.org/viewtopic-t-810606-highlight-.html

----------

## ppurka

 *sera wrote:*   

> You might want to join the thread at
> 
> https://forums.gentoo.org/viewtopic-t-810606-highlight-.html

 Unfortunately, my problem is with all kernel versions: 2.6.30, 2.6.31 and 2.6.32. So, the problem I am facing is different from the problem specified in the above thread.

----------

## ppurka

bump! Anyone with any ideas?  :Confused: 

----------

## region-g

Had similar issue in the past, had to make changes, in peripheral settings menu, for SATA controller in BIOS.

----------

## krinn

turning on/off ahci controller in bios will impact speed as big as 2x.

Some bios doesn't call the option ahci, but if you see controller set to compatible/legacy or name like that, sure this turn off ahci.

for linux: ahci on or off, the drive will work, it will just impact speed.

----------

## ppurka

krinn & region-g: Thank you both for your advice. 

This is an old (5 years old) machine. So, there is no ahci controller in the BIOS. The drive used to give me 45MBps earlier, and I don't remember having changed my BIOS settings anytime in the past couple of years. However, I will recheck the SATA settings, if any, in the BIOS.

EDIT I have gone over the bios again. There is nothing in the bios which seems suspect. There is in fact zero configuration for SATA in the BIOS.

----------

