# Can't Stop HDD from spinning down!!!

## gentoouser_54

Hey, I've had a new install of Gentoo running for a month now on my Asus EEEpc 1015pem, and I'm having a problem with my HDD spinning down constantly.

When on battery power, if the computer is left idle for a very short amount of time ~30seconds (maybe even less), and then the HDD is used, I can hear a high-pitch "winding-up" sound, that sounds like an electric motor starting up.

This concerns me, b/c I do not want my HDD spinning down at all and also b/c I dont not have HDD spindown enabled in gnome-power-manager OR with hdparm. I do have laptop-mode-tools emerged, but I havn't done anything with it and AFAIK it shouldn't be spinning down my disk.

Does anyone know what could be spinning down my HDD so frequently? Or perhaps I'm just tripping out and the HDD's in these EEEpc's just make weird noises that I'm not used to?

Anyone got some insight? Thanks in advance!

----------

## avx

What kind of disk is built-in (`hdparm -iI`)? Maybe it's one of those 'green' drives with spindown programmed in the firmware.

----------

## gentoouser_54

Here's the output that command... It's all greek to me.

```
billyjoe@netbooky /usr/portage/xfce-base/thunar $ sudo hdparm -iI /dev/sda

/dev/sda:

 Model=ST9250315AS, FwRev=0003SDM1, SerialNo=6VCLRL1L

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

 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=yes: unknown setting WriteCache=enabled

 Drive conforms to: unknown:  ATA/ATAPI-4,5,6,7

 * signifies the current active mode

ATA device, with non-removable media

   Model Number:       ST9250315AS                             

   Serial Number:      6VCLRL1L

   Firmware Revision:  0003SDM1

   Transport:          Serial

Standards:

   Used: unknown (minor revision code 0x0029) 

   Supported: 8 7 6 5 

   Likely used: 8

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:  488397168

   Logical/Physical Sector size:           512 bytes

   device size with M = 1024*1024:      238475 MBytes

   device size with M = 1000*1000:      250059 MBytes (250 GB)

   cache/buffer size  = 8192 KBytes

   Nominal Media Rotation Rate: 5400

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

   Advanced power management level: 254

   Recommended acoustic management value: 254, 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

      *   Advanced Power Management feature set

          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

      *   64-bit World wide name

      *   IDLE_IMMEDIATE with UNLOAD

          Write-Read-Verify feature set

      *   WRITE_UNCORRECTABLE_EXT command

      *   {READ,WRITE}_DMA_EXT_GPL commands

      *   Segmented DOWNLOAD_MICROCODE

      *   Gen1 signaling speed (1.5Gb/s)

      *   Gen2 signaling speed (3.0Gb/s)

      *   Native Command Queueing (NCQ)

      *   Phy event counters

          Device-initiated interface power management

      *   Software settings preservation

      *   SMART Command Transport (SCT) feature set

      *   SCT Long Sector Access (AC1)

      *   SCT Error Recovery Control (AC3)

      *   SCT Features Control (AC4)

      *   SCT Data Tables (AC5)

          unknown 206[12] (vendor specific)

Security: 

   Master password revision code = 65534

      supported

   not   enabled

   not   locked

      frozen

   not   expired: security count

      supported: enhanced erase

   66min for SECURITY ERASE UNIT. 66min for ENHANCED SECURITY ERASE UNIT.

Logical Unit WWN Device Identifier: 5000c5002babb8d9

   NAA      : 5

   IEEE OUI   : 000c50

   Unique ID   : 02babb8d9

Checksum: correct
```

----------

## avx

According to Google,  ST9250315AS is equal to Seagate Momentus 5400.6, which - also according to Google - is known to have (had) firmware problems (under linux) resulting in a lot spin-up/-downs, which can damage the disk quickly.

IMHO:

a) make a backup of important data

b) hunt down Google/Seagate for a firmware newer as yours (newer than 0003SDM1)

c) use smartmontools to check if damage already happened

----------

## gentoouser_54

Yikes that doesn't sound good!

Well.. I dont have "important data" so Im not too worried about that, and presently my HDD's in good condition.. but where/how do I download firmware for a hardrive? I dont think its in the portage tree.

I checked on Seagates website too but when I input my serial number I just got the message "No download available for this serial number. No action required".

----------

## avx

When I search the web for your firmware revision, I get a lot of ASUS parts sites at the top and some linux forums, which makes me believe, that this is a firmware by or designed for ASUS.

According to this website - which I don't know and just found via Google (so don't know if it can be trusted) - at least 7 different firmwares exist, or 7 different names for that matter.

For the same reason, unneeded spin-cycles, I lost 2 different 3.5" drives, WesternDigital (EADS and EARS series), because I didn't know a firmware with linux fixes existed. So in your case, I would compose an email describing the problem clearly and adding all info you can get and send them to both Seagate and ASUS.

As far as firmware-updating would go, usually the manufacturers give you some tool, which can be burned to cd or put an an usbdrive, which then gets booted and the firmware installed from there.

I'm sorry, but since there isn't much more info on the web (I could find), I can't help you much more with this  :Sad: 

----------

## tbart

just for the record:

Up until just now, i've had the exact same problems with both a Hitachi FDE and a WD Scorpio HD in a Thinkpad T61p.

Turns out I had to disable "Advanced Power Management":

```
blackknight ~ # hdparm -B 255 /dev/sda

/dev/sda:

 setting Advanced Power Management level to disabled

 APM_level   = off

```

The standby time (-S <number>) simply did not do anything.

I'll put this in my 

```
/etc/conf.d/hdparm
```

 and 

```
rc-update add hdparm boot
```

 and I guess the fix will be permanent.

What exactly makes this option get set is unintelligible to me, as it only happens after my notebook leaves standby...

EDIT:

Wait, I just found it. It's pm-utils.

Interesting parts in extra paragraphs. Color in code format won't work in this forum.

```
cat /usr/lib64/pm-utils/power.d/harddrive

#!/bin/sh

[ -x /sbin/hdparm ] || exit $NA

# Default values on AC

DRIVE_SPINDOWN_VALUE_AC="${DRIVE_SPINDOWN_VALUE_AC:-0}"

DRIVE_WRITE_CACHE_AC="${DRIVE_WRITE_CACHE_AC:-1}" 

DRIVE_POWER_MGMT_AC="${DRIVE_POWER_MGMT_AC:-254}"

DRIVE_ACOUSTIC_MGMT_AC="${DRIVE_ACOUSTIC_MGMT_AC:-0}"

# Default values on battery

DRIVE_SPINDOWN_VALUE_BAT="${DRIVE_SPINDOWN_VALUE_BAT:-6}"

DRIVE_WRITE_CACHE_BAT="${DRIVE_WRITE_CACHE_BAT:-0}" 
```

```
DRIVE_POWER_MGMT_BAT="${DRIVE_POWER_MGMT_BAT:-1}"
```

```

DRIVE_ACOUSTIC_MGMT_BAT="${DRIVE_ACOUSTIC_MGMT_BAT:-254}"

# Default devices to operate on

DRIVE_LIST="/dev/[hs]d[a-z]"

help() {

cat <<EOF

--------

$0: Control hard drive spindown, write caching, 

    power management and acoustic management.

This hook has 8 tuneable parameters:

DRIVE_SPINDOWN_VALUE_AC = time until a drive will spin down on AC

Defaults to 0, which disables drive spindown.

DRIVE_SPINDOWN_VALUE_BAT = time until a drive will spin down on battery

Defaults to 6, which will spin the drive down after 30 seconds of inactivity.

See the -S option on the hdparm manpage for more information.

DRIVE_WRITE_CACHE_AC = Whether the drive caches writes on AC

Defaults to 1, which means that the drive will cache writes internally.

DRIVE_WRITE_CACHE_BAT = Whether the drive caches writes on battery.

Defaults to 0 which means that the drive will not cache writes internally.

See the -W option on the hdparm man page for more information.

DRIVE_POWER_MGMT_AC = Drive Advanced Power Management value on AC

Defaults to 254 for max performance.

DRIVE_POWER_MGMT_BAT = Drive Advanced Power Management value on battery

Defaults to 1 for max power savings.

See the -B option on the hdparm man page

Drive acoustic management:

DRIVE_ACOUSTIC_MGMT_AC = Drive Acoustic Management value on AC

Defaults to 254 for max head speed.

DRIVE_ACOUSTIC_MGMT_BAT = Drive Acoustic Management value on battery

Defaults to 128 for max quietness.

See the -M option on the hdparm man page. 

Drives to manage:

DRIVE_LIST = the list of hard drives to manage.

Defaults to "/dev/[hs]d[a-z]", which will manage up to the first 25 drives.

EOF

}

harddrive_ac () {

    for dev in $DRIVE_LIST; do

   # disable write caching, do not spin down the drive, disable APM 

   # and acoustic management, and sync everything to drive.

   printf "Disabling hard drive power management for %s..." "$dev"

   hdparm -W $DRIVE_WRITE_CACHE_AC \

       -S $DRIVE_SPINDOWN_VALUE_AC \

       -B $DRIVE_POWER_MGMT_AC \

       -M $DRIVE_ACOUSTIC_MGMT_AC $dev >/dev/null 2>&1 \

       && echo Done. || echo Failed.

    done

}

harddrive_battery() {

    for dev in $DRIVE_LIST; do

   # disable write caching, enable acoustic management

   printf "Enabling power management for %s..." "$dev"

   hdparm -W $DRIVE_WRITE_CACHE_BAT \

       -S $DRIVE_SPINDOWN_VALUE_BAT \

       
```

```
-B $DRIVE_POWER_MGMT_BAT \
```

```

       -M $DRIVE_ACOUSTIC_MGMT_BAT -F $dev >/dev/null 2>&1 \

       && echo Done. || echo Failed.

    done

}

case $1 in

    true) harddrive_battery ;;

    false) harddrive_ac ;;

    help) help;;

    *) exit $NA ;;

esac

exit 0

```

I think setting this default to 30 seconds spindown is crazy. YMMV.

Therefore, setting the option via /etc/init.d/hdparm won't solve the problem. Either you'll have to put it into

```
/etc/pm/sleep.d/50-whateveryoulike
```

and put something like

```
[[ $1 == "resume" ]] || [[ $1 == "thaw" ]] && { hdparm -B 255 /dev/sda; exit; }
```

into it (or a call to 

```
/etc/init.d/hdparm restart
```

) or

(which seems cleaner to me)

fix the original error, but better not do it in /usr but in /etc so it survives updates.

Maybe you can put a copy of 

```
/usr/lib64/pm-utils/power.d/harddrive
```

 into 

```
/etc/pm/power.d/harddrive
```

 and set sane values. I don't know, but there must be some way to fix it in /etc.

hth,

th

----------

## tbart

well I think setting the config values to a predefined value will be better:

simply define the values in a file like 

```
/etc/pm/config.d/harddrive
```

:

```
DRIVE_SPINDOWN_VALUE_BAT=0

DRIVE_WRITE_CACHE_BAT=1 

DRIVE_POWER_MGMT_BAT=255

DRIVE_ACOUSTIC_MGMT_BAT=0
```

just found a forum post regarding this:

https://forums.gentoo.org/viewtopic-t-897692-start-0.html

However, Advanced PM is now always at 128 for me, though I set 255... strange.

----------

## ppurka

I have a WD drive that also behaves extremely irrationally.  It spins down every 5 seconds! I have to run two hdparm commands to keep it from spinning down:

```
hdparm -S 241 /dev/sda

hdparm -B 254 /dev/sda
```

Sometimes I think the hard drive manufacturers deliberately set these settings, so that the drives fail more quickly and you buy more.

----------

