专栏首页全栈程序员必看about ubuntu hard disk

about ubuntu hard disk


Bug 59695 (“default value in power.sh potentially kills laptop disks”) is about not preventing bad behaviour of drives (high Load_Cycle_Count numbers) on (laptop) harddrives.

Because the bug report has 150 comments already, I’ve tried to summarize it here.

There appear to be two issues here: HDD spin down and “Power cycling”, whereas the first one has a

relative short default (60 seconds), but the latter one gets the most complains (it’s about Load_Cycle_Count).

The disk Load_Cycle_Count issue appears to be caused by a combination of two problems — The first is overly-aggressive power management from what might be considered buggy hardware. The second is that Ubuntu appears to be touching the hard drive on a regular basis for one reason or another.

Note: In sections below relating to how to prevent damage to your hard disk, you should replace $HDD everywhere with your device, e.g. “/dev/sda” or “/dev/hda”. If you have several harddrives, you need to change it accordingly and duplicate lines in workarounds.


You can check the current value of Load_Cycle_Count of your harddrive(s) using:

  • sudo smartctl -a $HDD | grep Load_Cycle_Count

(You need the smartmontools package for this. I also had to enable SMART monitoring for my drives using sudo smartctl -s on $HDD)

The values for this differ a lot (e.g. it’s 0 on my desktop), but it goes up to > 600.000 for others, depending on the lifetime. TODO: add a section with sample values (including the value of Power_On_Hours).

What Ubuntu does

It appears to be the official policy of Ubuntu that by default, Ubuntu should not adjust any power management settings of the harddisk. Unfortunately, this policy has two negative effects: It leaves quite a few people with broken hard drives that would otherwise not be broken, and it quite simply makes people who love Ubuntu feel neglected. This issue has been going on a long time.

The problem appears to be that some manufacturers’ defaults are too aggressive and that Ubuntu might cause too many unbuffered disk accesses — the combination of which can cause over a thousand parks a day on some systems.

In /etc/acpi/power.sh, laptop mode gets handled. If it gets enabled, hdparm is called with “-B 1”, if it gets disabled with “-B 254”. 254 is the least aggressive setting. 255 is off, but does not work for all disks.

In power.sh also the spindown timeout gets set, according to SPINDOWN_TIME from /etc/default/acpi-support (default: 12). This results in spinning down the harddrive after 12*5=60 seconds of inactivitiy. This does not influence Load_Cycle_Count however.


“/etc/apm” is not supposed to be used, but if it would get, it sets spindown to 60 seconds – but does not affect the general APM setting (hdparm -B). (there’s a bug, which also used “power_conserve” here, if on_ac_power return “don’t know” – bug 156893)


Blue has created a script, which acts as a wrapper around hdparm and logs, where it’s called (including its arguments) From his report, it appears that hdparm always gets called through apm or the init script (the logfile excerpt appears to be from booting).

TODO: provide said helper script, allowing others to help to debug this.


Various workarounds have been provided.

Try hdparm -B 255 HDD or hdparm -B 254 HDD. (255 is supposed to disable APM, but it does not work for some; so 254 sets it to the less aggressive setting)

There are different methods to keep this setting after reboot/resume. Your mileage may vary. There may be more workarounds in the bug report, but essentially, all are using “hdparm -B” to change the apm handling of the harddrive.


  • UbuntuDemon I brought some of these proposed fixes together in the hope that is easier to apply for users who are suffering from this problem

Force hdparm values in acpi hooks

Gilles posted the following workaround: Create a file called 99-fix-park.sh (keep the ’99-‘ and the ‘.sh’, but you can name the file as you like otherwise) with the following two lines:

 hdparm -B 254 $HDD

and copy it to the following directories: /etc/acpi/resume.d/ and /etc/acpi/start.d/ (



Don posted another workaround: Install laptop-mode-tools and set CONTROL_HD_POWERMGMT=1 in /etc/laptop-mode/laptop-mode.conf (

https://launchpad.net/ubuntu/+source/acpi-support/+bug/59695/comments/19) Here’s another more verbose setup of laptop-mode-tools from Michael:


Proposed fixes

  • FIXED: Converted most remaining 255’s to 254s, and added an explanation.


This bug report has attracted a lot of concerned Ubuntu users and it seems quite clear from the user feedback, that other operating systems/distributions handle this better. However, the workaround should be quite simple and this wiki page is a first attempt, to fix this for the better.


ubuntu_demon has put together a list of TODOs:



Please leave any comments/additions here. You may also edit the page directly, but please try to be clear and helpful. The problem has been confirmed and we know that it’s a critical thing – please do not repeat that the bug status should be critical.

Could you kindly explain how to diagnose whether the settings on a system, at a point of time, are correct. I have followed the instructions but still find the load cycle count increasing. How do I diagnose the problem?

last edited 2007-11-12 23:26:01 by VikasRawal




0 条评论
登录 后参与评论


  • VirtualBox 使用总结

    最近接触使用VirtualBox,相比VMware的简单粗暴,刚接触VirtualBox还是有些 心累的,不过VirtualBox是开源的,没有版权问...

  • HDUOJ----(4788)Hard Disk Drive

    Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Ot...

  • LeetCode MySQL 1549. The Most Recent Orders for Each Product

    Write an SQL query to find the most recent order(s) of each product.

  • VirtualBox相关问题总结

    VirtualBox Images: http://www.osboxes.org/virtualbox-images VirtualBoxes – Free ...

  • VirtualBox相关问题总结

    邮箱: jiangxinnju@163.com 博客园地址: http://www.cnblogs.com/jiangxinnju GitHub地址: ht...

  • 使用 kubeadm 在 GCP 部署 Kubernetes

    最近在准备 CKA 考试,所以需要搭建一个 Kubernetes 集群来方便练习.GCP 平台新用户注册送 300 刀体验金,所以就想到用 kubeadm 在 ...

  • 全盘加密的案例(computing data management)


  • 使用 Cobbler 批量自动化部署 CentOS / Ubuntu

    本文主要讲解通过 CentOS 7.6 Minimal + Cobbler 自动化安装 CentOS / Ubuntu 。

  • linux 命令中英文对照,收集

    听说markdown排版得用浏览器打开,点击最下面的阅读原文也可以! Is Linux CLI case-sensitive? The answer is, y...