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

Asked by Rafał Ochmański on 2012-11-09

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
5

# cat /proc/sys/vm/dirty_writeback_centisecs
30000

# cat /proc/sys/vm/dirty_background_ratio
15

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

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].

[1] https://bugs.launchpad.net/ubuntu/+source/linux/+bug/607560
[2] http://www.ubuntu.com/certification/hardware/201105-8049/

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu util-linux Edit question
Assignee:
No assignee Edit question
Solved by:
N1ck 7h0m4d4k15
Solved:
2012-11-10
Last query:
2012-11-10
Last reply:
2012-11-10
Rafał Ochmański (rmopl) said : #1

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

Best N1ck 7h0m4d4k15 (nicktux) said : #2

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.

BUT

your
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

Thanks

Rafał Ochmański (rmopl) said : #3

# 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.

Thanks.

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.

Rafał Ochmański (rmopl) said : #4

Thanks NikTh, that solved my question.