laptop hard disk etiquette

Pádraig Brady P at
Fri Oct 26 21:48:17 UTC 2007

Pádraig Brady wrote:
> Nicolas Mailhot wrote:
>> Le Ven 26 octobre 2007 17:26, Pádraig Brady a écrit :
>>> Also what is causing the drive to "load"
>>> so often after an "unload"?
>> On old hard drives pretty much anything can cause the disk to spin up
>> again. Sometimes querrying the hard drive status (are you suspended?)
>> is sufficient to wake it up (don't laugh)
> So possibly running smartctl -A will cause the drive to load.
> I.E. it's a self fulfilling prophecy :)

Well with me being a muppet it definitely will cause the drive to "load"
Each time I ran smartctl previously the atime was updated, causing a "load".

I did some more investigation, the summary of which is:

1. ubuntu dicks with the drive spin down timers when on battery
2. fedora does not (as Bill suggested)
3. fedora should probably not (as Alan suggested)
4. fedora should probably default to relatime mount option
   on laptops at least (as Ingo suggested here: )


I turned off atime updates using:
# mount -oremount,noatime /

And verified there were no disk accesses using:
# /etc/init.d/syslog stop
# echo 1 > /proc/sys/vm/block_dump
# dmesg -c
# dmesg -c
# ...

So testing again using this function:

lcc() {
    while true; do
        smartctl -i -A /dev/sda |
        grep -F Load_Cycle_Count |
        tr -s ' ' | cut -d ' '  -f 2,10

        sleep $sec

This shows that smartctl does in fact seem to cause a "load" :)
# lcc 10
Load_Cycle_Count 351623
Load_Cycle_Count 351624
Load_Cycle_Count 351625
Load_Cycle_Count 351626
Load_Cycle_Count 351627

Here the disk isn't given a chance to unload
# lcc 5
Load_Cycle_Count 351629
Load_Cycle_Count 351629
Load_Cycle_Count 351629
Load_Cycle_Count 351629
Load_Cycle_Count 351629

This implies it's the disk has an adaptive rather than a simple timeout
as 10 seconds was previously long enough for the drive to "unload"
# lcc 10
Load_Cycle_Count 351636
Load_Cycle_Count 351636
Load_Cycle_Count 351636
Load_Cycle_Count 351636
Load_Cycle_Count 351636

Taking averages over a long time seems to be appropriate so.
Noting that this laptop was running FC4 for most of its life,
and that it has the following defaults:
# hdparm -I /dev/sda | grep "Advanced power management level"
        Advanced power management level: 128 (0x80)
Using the smart Power_On_Hours value, shows that in total
it has load cycled on average once every 48s:
# echo "scale=2; (4718*60*60)/351675" | bc

That's far too aggressive, especially considering this
laptop is plugged in most of the time.
But also note that atime updates were enabled (as per default),
which probably exacerbated the problem.
I'll disable that first on all partitions and if that
doesn't suffice I'll make the "unloading" less agressive
using the `hdparam -B $level /dev/sda` command.


p.s. I did a quick check using the following
to show that on an idle F7 laptop with noatime set,
the disk is not accessed for 15 min at least, which is encouraging:

while true; do
    dmesg -c | grep sda | grep -Ev '(pdflush|kjournald)'
    sleep 10

More information about the fedora-devel-list mailing list