How to make the disk spin down and stay spun down?

Asked by Rafał Ochmański

How to make the disk spin down and stay spun down? Currently, under Ubuntu 12.10 the disk will not spin down on its own and when forced to, spins up almost immediately? How do I keep it quiet?

**Basic info:**

# uname -a
Linux flax 3.5.0-18-generic #29-Ubuntu SMP Fri Oct 19 10:26:51 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 12.10
Release: 12.10
Codename: quantal

**What I have tried:**

I have enabled powersave for everything related to the disk I could find, extended the commit time and other tricks for ext4, tried forcing the disk to spin down with hdparm:

# cat /proc/mounts
/dev/mapper/ubuntu-root / ext4 rw,noatime,nobarrier,errors=remount-ro,commit=600 0 0

# cat /etc/fstab
/dev/mapper/ubuntu-root / ext4 errors=remount-ro,data=writeback,commit=600,noatime,nobh,barrier=0 0 1

# cat /proc/sys/vm/laptop_mode

# cat /proc/sys/vm/dirty_writeback_centisecs

# cat /proc/sys/vm/dirty_background_ratio

# cat /sys/class/scsi_host/host*/link_power_management_policy

None of those seem to have any effect, the disk won't spin down (ever) and when forced to (# hdparm -y /dev/sda), comes back up very quickly, immediately after any write, actually. Though those changes do seem to make the jbd2 problem[1] a little better.

Now, I could chase down every single application that is writing to the disk, and turn it off, or stop it from writing. But that way, I may as well turn the computer off, the idea is to have the system hold on to the changes and write them down only once in a while, right? So how do I do it? What other info should I provide?

It's a Dell V131, certififed for Ubuntu[2].


Question information

English Edit question
Ubuntu util-linux Edit question
No assignee Edit question
Solved by:
N1ck 7h0m4d4k15
Last query:
Last reply:
Revision history for this message
Rafał Ochmański (rmopl) said :

I tried testing it with Ubuntu 12.04 (the one it's certified for) and it also doesn't work. The disk keeps spinning.

Revision history for this message
Best N1ck 7h0m4d4k15 (nicktux) said :

You can change some attributes with hdparm and the switch -B .

When you find the appropriate value , the value that meet your needs you can add the command to rc.local to be executed in every startup.


HDD has to support these attributes , or else nothing will happen.

See with this command what is the APM (Advanced Power Management) value.

~$ sudo hdparm -B /dev/sda

and then read the man-page of hdparm to see what value you have to set to spin down the disk

~$ man hdparm

The command should be

~$ sudo hdparm -B <the value here> /dev/sda


Revision history for this message
Rafał Ochmański (rmopl) said :

# hdparm -S 12 -B 48 /dev/sda

Yes, more aggressive (64 or even 48) Advanced Power Management and moving ~/.mozilla to ramdisk made it much better, though random spin-ups still happen.


Is there some sort of a tool to automatically move browser profiles, maybe other dotfiles, or selected resources to a ramdisk and resync later? Either at shutdown or on sort of schedule.

Revision history for this message
Rafał Ochmański (rmopl) said :

Thanks NikTh, that solved my question.