# [SOLVED] Insane disk latency on laptop

## Gabriel_Blake

Hi.

I've been having this problem since I bought the Acer 3820TG. Thanks to some stupid power saving feature, my hard drive stops when not used (it spins down). Then when it's used by some app it takes 1-3 seconds to start running! During this time the entire laptop freezes! 

The funny thing is that when I use smplayer, the video stops every couple of minutes (for disk access), but when I play music via moc the disk is spinning constantly and everything runs smoothly.

I'm not sure whether it's a hardware issue, or some kernel/software config. Could you give me some hints ? (that tools can I use to get more info on the disk and it's performance or just how to fix it)Last edited by Gabriel_Blake on Sat Aug 06, 2011 11:05 am; edited 1 time in total

----------

## Hypnos

Look at your disk settings:

```
# hdparm -i /dev/<your disk>
```

Look at your disk health:

```
# smartctl -a /dev/<your disk>
```

'smartctl' is in the package 'smartmontools' .

----------

## tclover

Or increase the timeout value with something like `/sbin/hdparm -q -S120 /dev/sda` and you're all set.

----------

## Hypnos

Oops, forgot that "hdparm -i" doesn't give current settings ...

----------

## Gabriel_Blake

I sense a disturbance in the force. Something is wrong here:

```
/dev/sda:

 Model=WDC WD5000BEVT-22A0RT0, FwRev=01.01A01, SerialNo=WD-WX31A50S2338

 Config={ HardSect NotMFM HdSw>15uSec SpinMotCtl Fixed DTR>5Mbs FmtGapReq }

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

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

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

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

 PIO modes:  pio0 pio3 pio4 

 DMA modes:  mdma0 mdma1 mdma2 

 UDMA modes: udma0 udma1 udma2 udma3 udma4 udma5 *udma6 

 AdvancedPM=yes: unknown setting WriteCache=enabled

 Drive conforms to: Unspecified:  ATA/ATAPI-1,2,3,4,5,6,7

 * signifies the current active mode
```

```
=== START OF INFORMATION SECTION ===

Model Family:     Western Digital Scorpio Blue Serial ATA family

Device Model:     WDC WD5000BEVT-22A0RT0

Serial Number:    WD-WX31A50S2338

Firmware Version: 01.01A01

User Capacity:    500,107,862,016 bytes

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

ATA Version is:   8

ATA Standard is:  Exact ATA specification draft version not indicated

Local Time is:    Fri Aug  5 01:52:58 2011 CEST

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:  (0x00)   Offline data collection activity

               was never started.

               Auto Offline Data Collection: Disabled.

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:        (12780) seconds.

Offline data collection

capabilities:           (0x7b) SMART execute Offline immediate.

               Auto Offline data collection on/off support.

               Suspend Offline collection upon new

               command.

               Offline surface scan supported.

               Self-test supported.

               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.

               General Purpose Logging supported.

Short self-test routine 

recommended polling time:     (   2) minutes.

Extended self-test routine

recommended polling time:     ( 149) minutes.

Conveyance self-test routine

recommended polling time:     (   5) minutes.

SCT capabilities:           (0x7037)   SCT Status supported.

               SCT Feature Control supported.

               SCT Data Table supported.

SMART Attributes Data Structure revision number: 16

Vendor Specific SMART Attributes with Thresholds:

ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE

  1 Raw_Read_Error_Rate     0x002f   200   200   051    Pre-fail  Always       -       0

  3 Spin_Up_Time            0x0027   188   153   021    Pre-fail  Always       -       1600

  4 Start_Stop_Count        0x0032   016   016   000    Old_age   Always       -       84209

  5 Reallocated_Sector_Ct   0x0033   200   200   140    Pre-fail  Always       -       0

  7 Seek_Error_Rate         0x002e   100   253   000    Old_age   Always       -       0

  9 Power_On_Hours          0x0032   095   095   000    Old_age   Always       -       3721

 10 Spin_Retry_Count        0x0032   100   100   051    Old_age   Always       -       0

 11 Calibration_Retry_Count 0x0032   100   100   000    Old_age   Always       -       0

 12 Power_Cycle_Count       0x0032   100   100   000    Old_age   Always       -       895

191 G-Sense_Error_Rate      0x0032   001   001   000    Old_age   Always       -       243

192 Power-Off_Retract_Count 0x0032   200   200   000    Old_age   Always       -       93

193 Load_Cycle_Count        0x0032   054   054   000    Old_age   Always       -       440974

194 Temperature_Celsius     0x0022   111   101   000    Old_age   Always       -       36

196 Reallocated_Event_Count 0x0032   200   200   000    Old_age   Always       -       0

197 Current_Pending_Sector  0x0032   200   200   000    Old_age   Always       -       0

198 Offline_Uncorrectable   0x0030   100   253   000    Old_age   Offline      -       0

199 UDMA_CRC_Error_Count    0x0032   200   200   000    Old_age   Always       -       0

200 Multi_Zone_Error_Rate   0x0008   100   253   051    Old_age   Offline      -       0

SMART Error Log Version: 1

No Errors Logged

SMART Self-test log structure revision number 1

No self-tests have been logged.  [To run self-tests, use: smartctl -t]

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.

```

----------

## Hypnos

Looks normal enough.  You can do what tclover says and see if the situation improves.

Also, if you like, run a disk diagnostic, as described in the smarctl man page.  Probably it will be normal as well.

----------

## redagadir

tclover's advice looks wise, disable poweroff on inactivity.

just make sure it stays persistent across reboots.

and just to be sure, check these:

$ hdparm -tT /dev/sda #if sda is your disk

$ smartctl -t short /dev/sda

then after a while (few minutes)

$ smartctl -a /dev/sda

and read the short test result

if you have time:

$ smartctl -t long /dev/sda

and read again results after some timeLast edited by redagadir on Wed Dec 21, 2011 9:19 am; edited 1 time in total

----------

## Gabriel_Blake

 *tclover wrote:*   

> Or increase the timeout value with something like `/sbin/hdparm -q -S120 /dev/sda` and you're all set.

 

Absolutely fixed everything  :Smile:  Sets the spin-down to 10min so it's fine, but I've used it with -S0 so it's off.

I'm not sue if these settings are permanent, so to be sure I've added the command to /etc/local.d/driveNoStandby.start

----------

## Hypnos

You can also put the setting in /etc/conf.d/hdparm , then add the hdparm service to the default runlevel.

----------

## Hu

 *Gabriel_Blake wrote:*   

> I'm not sue if these settings are permanent, so to be sure I've added the command to /etc/local.d/driveNoStandby.start

 If the settings are not permanent, you may find that they are forgotten after you hibernate and resume the system.  If so, you would need to add an equivalent hdparm setting to your resume scripts to reapply the setting after the system wakes up.

----------

