about ubuntu hard disk

about ubuntu hard disk

DanielHahler/Bug59695

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

Check

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

apm

[WWW] “/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” – [WWW] bug 156893)

Debug

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

Workaround

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.

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:

 #!/bin/sh
hdparm -B 254 $HDD

and copy it to the following directories: /etc/acpi/resume.d/ and /etc/acpi/start.d/ ([WWW] https://launchpad.net/ubuntu/+source/acpi-support/+bug/59695/comments/10)

laptop-mode-tools

Don posted another workaround: Install laptop-mode-tools and set CONTROL_HD_POWERMGMT=1 in /etc/laptop-mode/laptop-mode.conf ([WWW] https://launchpad.net/ubuntu/+source/acpi-support/+bug/59695/comments/19) Here’s another more verbose setup of laptop-mode-tools from Michael: [WWW] https://launchpad.net/ubuntu/+source/acpi-support/+bug/59695/comments/63

Proposed fixes

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

Conclusion

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.

Misc

ubuntu_demon has put together a list of TODOs: [WWW] https://launchpad.net/ubuntu/+source/acpi-support/+bug/59695/comments/81

Comments

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

 

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/100567.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • ehcache缓存原理_实现lru缓存

    ehcache缓存原理_实现lru缓存运用你所掌握的数据结构,设计和实现一个 LRU (最近最少使用) 缓存机制 。实现 LRUCache 类:LRUCache(int capacity) 以正整数作为容量 capacity 初始化 LRU 缓存int get(int key) 如果关键字 key 存在于缓存中,则返回关键字的值,否则返回 -1 。void put(int key, int value) 如果关键字已经存在,则变更其数据值;如果关键字不存在,则插入该组「关键字-值」。当缓存容量达到上限时,它应该在写入新数据之前删除最久

    2022年8月8日
    3
  • Idea激活码永久有效Idea2020.2.1激活码教程-持续更新,一步到位

    Idea激活码永久有效Idea2020.2.1激活码教程-持续更新,一步到位Idea激活码永久有效2020.2.1激活码教程-Windows版永久激活-持续更新,Idea激活码2020.2.1成功激活

    2022年6月17日
    265
  • vue开发环境搭建及配置[通俗易懂]

    vue开发环境搭建及配置[通俗易懂]转:https://www.cnblogs.com/harbors/p/12673337.html

    2022年10月19日
    4
  • 开源游戏引擎哪家强?八款知名引擎资料够你忙[通俗易懂]

    开源游戏引擎哪家强?八款知名引擎资料够你忙[通俗易懂]游戏引擎是指一些已编写好的可编辑电脑游戏系统或者一些交互式实时图像应用程序的核心组件。本文介绍了几款常见的开源游戏引擎,并附上相关资料。游戏引擎是指一些已编写好的可编辑电脑游戏系统或者一些交互式实时图像应用程序的核心组件。这些系统为游戏设计者提供各种编写游戏所需的各种工具,其目的在于让游戏设计者能容易和快速地做出游戏程式而不用由零开始。以下介绍了几款常见的开源游戏引擎:OGRE

    2022年10月21日
    2
  • LSTM 08:超详细LSTM调参指南

    LSTM 08:超详细LSTM调参指南本文讨论了如何调整LSTM超参数。

    2022年7月19日
    41
  • 2020版Java视频教程|java零基础到就业全套视频教程线上免费观看,java免费教程直接看

    2020版Java视频教程|java零基础到就业全套视频教程线上免费观看,java免费教程直接看第一阶段:Java基础学习任何一门编程语言,首先要学习的是基础语法,开启Java学习的第一步,当然就是深入掌握计算机基础、编程基础语法,面向对象,集合、IO流、线程、并发、异常及网络编程,这些我们称之为JavaSE基础。当你掌握了这些内容之后,你就可以做出诸如:电脑上安装的迅雷下载软件、QQ聊天客户端、考勤管理系统等桌面端软件。第二阶段:数据库互联网最具价值的是数据,任何编程语言都需要解决数据存储问题,而数据存储的关键技术是数据库。MySQL和Oracle都是广受企业欢迎的数据库管理系统。Java

    2022年7月7日
    27

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号