Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I use Ubuntu 12 beta on a Lenovo Z575. I noticed that the disk spins down a few seconds after the last operation. When I am working, e.g. in the vim and write quite often, it spins-up and -down frequently. This causes vim to freeze for a second.

I used hdparm but it didn't change anything:

hdparm -S 24 /dev/sda # 2 minutes standby time

and I see (and hear) that the disk is idle or working:

hdparm -C /dev/sda
drive state is: standby
# or...
drive state is: active/idle

I have laptop-mode-tools already installed.

share|improve this question

2 Answers 2

Try hdparm -B 254 /dev/sda

My drive seems to ignore -S commands but listens to -B commands.

share|improve this answer
    
Yea, most laptop drives seem to use the old depreciated APM commands that -B uses. –  psusi Jun 24 '13 at 3:34

Maybe your computer works in laptop mode. To change the behaviour of laptop mode in Ubuntu you should change parameters in file /etc/laptop-mode/laptop-mode.conf . These parameters among others could affect you:

#
# Idle timeout values. (hdparm -S)
# Default is 2 hours on AC (NOLM_HD_IDLE_TIMEOUT_SECONDS=7200) and 20 seconds
# for battery and for AC with laptop mode on.
LM_AC_HD_IDLE_TIMEOUT_SECONDS=20 
LM_BATT_HD_IDLE_TIMEOUT_SECONDS=20 
NOLM_HD_IDLE_TIMEOUT_SECONDS=7200

#
# Power management for HD (hdparm -B values)
# 
BATT_HD_POWERMGMT=1 
LM_AC_HD_POWERMGMT=254 
NOLM_AC_HD_POWERMGMT=254

Also in Debian distributions there could be some parameters in the file /etc/default/laptop-mode (but my Ubuntu 12.04 does not have this file).

There are some parameters that controls idle timeout that (here a citation):

AC_HD/BATT_HD The idle timeout that should be set on your hard drive when laptop mode is active (BATT_HD) and when it is not active (AC_HD). The defaults are 20 seconds (value 4) for BATT_HD and 2 hours (value 244) for AC_HD. The possible values are those listed in the manual page for "hdparm" for the "-S" option.


There is additionally a kernel laptop mode. Computer that works in kernel laptop mode will be spinning disk up slower but it should not change the spinning down behaviour.

To check kernel laptop mode try: cat /proc/sys/vm/laptop_mode If the value is 1 or more it means the computer works in laptop mode. To disable laptop mode set it to 0.

A cite from https://www.kernel.org/doc/Documentation/laptops/laptop-mode.txt : "The result of this is that after a disk has spun down, it will not be spun up anymore to write dirty blocks, because those blocks had already been written immediately after the most recent read operation."

Additional information about the kernel laptop mode could be found at site given above.

share|improve this answer
    
well, it is a laptop... Lenovo Z575 –  Jakub M. Apr 26 '12 at 13:27
    
@JakubM. One of "feature" of laptop mode is to save battery by often suspending the disk. ;-) See laptop mode tools . You can try to tweak your setting in laptop-mode.conf (probably in /etc - I don't know Ubuntu very well) –  digital_infinity Apr 26 '12 at 20:55
    
laptop_mode doesn't actually spin the disk down, it just flushes all writes whenever there's any disk activity to get them out of the way so the disk can spin down and not be woken back up soon by pending writes. –  psusi Jun 24 '13 at 3:33
    
@psusi I did not write anything contrary to your comment, and actually my answer is a little simplification of the problem so I don't know why you down voted the answer –  digital_infinity Nov 6 '13 at 17:41
    
@digital_infinity, I down voted because setting laptop_mode to zero will not keep the disk from spinning down. –  psusi Nov 6 '13 at 21:29

Your Answer

 
discard

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.