# hdparm, libata, harddisk spins up and down

## Martux

Hello!

I just discovered that hdparm can handle sata drives now as well.

I have 2 harddisk in my computer, 1 for linux, 1 for windows.

What i want to do is put my windows drive to sleep permanently, only letting it wake up if really needed.

That for I set hdparm -B 1 /dev/sdb and hdparm -S 1 /dev/sdb, which is supposed to spin down the disk after 5 seconds. This works very well but about every 30 seconds the disk is spun up again.

What can I do to keep it spun down?

There are no processes accessing the disk, it has an entry in fstab because it' s mounted with ntfs-3g and I don' t know if kde-media can handle this alone.

Any help appreciated  :Smile: 

----------

## mitchd123

I added these lines to my /etc/conf.d/hdparm file.  Notice I'm letting my root drive /dev/hda stay awake.

hdb_args="-S180"

sda_args="-S180"

sdb_args="-S180"

sdc_args="-S180"

sdd_args="-S180"

To see if this worked, drive state can be verified by:

hdparm -C  /dev/hdb

It should return something like this:

/dev/hdb:

 drive state is:  standby

Then add hddparm to startup: 

rc-update add hddparm boot

----------

## Martux

Yeah, sure. But my drive keeps spinning up again after been put to sleep with -Y or any given -S.

That happens even if the drive is not mounted at all.

----------

## Cyker

I have a similar problem; I gave up trying to figure what's spinning it up and just have s cronjob that runs "hdparm -y /dev/hdc" every hour or so  :Smile: 

----------

## Martux

Cyker, thanks for confirmation.

Isn't that reducing the lifetime of the hd dramatically?

I hate hearing my drives clicking...

I found http://noflushd.sourceforge.net/ but it seems rather old.

Anybody tried that?

----------

## Cyker

Well, mine will often stay sleeping for weeks, and then suddenly spin up, so I just keep telling it to sleep so when it does spin up it won't stay on for to long.

If the thing is spinning up very frequently (i.e. >once a day) then yes, this cronjob **WILL KILL THE DRIVE**.

Never tried noflushd, suspect it will not help, but worth a go I suppose... if you do try it, let me know if it works!  :Smile: 

----------

## kernelOfTruth

you guys by chance a running gnome or even only nautilus ?

----------

## Cyker

KDE here, no HAL, no DBUS.

The weird thing is, the drive in question is basically a clone of the main boot drive, but is otherwise unused and unmounted!

----------

## Martux

Me runs KDE-3.5.10 here. Hal & DBus active. USE="-acpi" set globally.

My drive is unmounted too, but spins up every 30s or so.

```

hdparm -I /dev/sdb

/dev/sdb:

ATA device, with non-removable media

        Model Number:       SAMSUNG HD502IJ

        Serial Number:      S13TJDWQ646591

        Firmware Revision:  1AA01112

Standards:

        Used: ATA-8-ACS revision 3b

        Supported: 7 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:  268435455

        LBA48  user addressable sectors:  976773168

        Logical/Physical Sector size:           512 bytes

        device size with M = 1024*1024:      476940 MBytes

device size with M = 1000*1000:      500107 MBytes (500 GB)

        cache/buffer size  = 16384 KBytes (type=DualPortCache)

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

        Advanced power management level: disabled

        Recommended acoustic management value: 254, current value: 128

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

             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

           *    NOP cmd

           *    DOWNLOAD_MICROCODE

                Advanced Power Management feature set

                Power-Up In Standby feature set

*    SET_FEATURES required to spinup after power up

                SET_MAX security extension

           *    Automatic Acoustic Management feature set

           *    48-bit Address feature set

           *    Device Configuration Overlay feature set

           *    Mandatory FLUSH_CACHE

           *    FLUSH_CACHE_EXT

           *    SMART error logging

           *    SMART self-test

                Media Card Pass-Through

           *    General Purpose Logging feature set

           *    64-bit World wide name

           *    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)

           *    Host-initiated interface power management

           *    Phy event counters

           *    NCQ priority information

                DMA Setup Auto-Activate optimization

                Device-initiated interface power management

           *    Software settings preservation

           *    SMART Command Transport (SCT) feature set

           *    SCT Long Sector Access (AC1)

           *    SCT LBA Segment Access (AC2)      

 *    SCT LBA Segment Access (AC2)

           *    SCT Error Recovery Control (AC3)

           *    SCT Features Control (AC4)

           *    SCT Data Tables (AC5)

Security:

        Master password revision code = 65534

                supported

        not     enabled

        not     locked

        not     frozen

        not     expired: security count

                supported: enhanced erase

        110min for SECURITY ERASE UNIT. 110min for ENHANCED SECURITY ERASE UNIT.

Logical Unit WWN Device Identifier: 50000f0003465619

        NAA             : 5

        IEEE OUI        : 0000f0

        Unique ID       : 003465619

Checksum: correct

```

Doesn' t change anything if I enable/disable APM features...

----------

