Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Can I have stronger laptop mode in Linux?

I want to spin down the hard drive and prevent it to spin up even if something wants to read something not in cache. In general I want to have these modes:

  1. Normal
  2. Current laptop mode
  3. Stronger laptop mode: spin up only when needs to read something uncached (and cache it). No spinups to write something unless really memory pressure (Exception: explicit "sync" command in console). Kernel is allowed to keep processes in D-sleep for 10 seconds for that.
  4. Forced laptop mode: do not spin up, period. Keep offending processes in D-sleep unless I turn off this mode. Like there is a bomb instead of hard drive.

I also want to have access times tracked (mount -o atime), but I don't want the hard drive to be spinned up only to update them.

Is there some settings or kernel patches that can get closer to this?

May be I should write special io scheduler for "forced laptop mode"? E.g. echo suspend > /sys/block/sda/queue/scheduler to lock the drive and echo cfq > /sys/block/sda/queue/scheduler to unlock it again?

share|improve this question
+1 Interesting question – Nifle Mar 16 '10 at 7:12
Should it be migrated to stackoverflow? Or just closed? (I've implemented one of modes I told about). – Vi. Mar 18 '10 at 2:56
up vote 1 down vote accepted

Quickly coded the "forced laptop mode" as io scheduler. Tested first in UML, then on my laptop even without a reboot.

When I issue echo hung > /sys/block/sda/queue/scheduler, followed by hdparm -y /dev/sda the hard drive stops and don't resumes.

When I need to read something I just do "echo cfq > /sys/block/sda/queue/scheduler.

Also I can see what processes are wanting to cause spinup (they are D-sleeping). reiserfs and pdflush gets hung. Then syslogd.

To prevent sync attempts I temporarily disable syncs echo 0 > /proc/sys/fs/sync-enable. It should be more or less safe given hard drive is already locked up. This is provided by

share|improve this answer
But now I need to temporarily disable fsync/fdatasync and all that things... – Vi. Mar 17 '10 at 22:47
at this point, it sounds like you're deep in SO territory – Journeyman Geek Mar 17 '10 at 23:37
Testing the next patch: – Vi. Mar 17 '10 at 23:56

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.