26
Nov

关于Ubuntu损坏笔记本硬盘的问题

如果你在自己的笔记本上尝试Ubuntu,这个问题可能会让你望而却步。我在Dell Latitude D620上装Ubuntu已经有一年多了,一直也没有去太过于关注这个问题。因为据说是和高级电源管理有关,我一直是放在docking上用AC,心想应该没问题吧?

近日要写D620和D630上Ubuntu安装指南,所以不得不重新去关注一下。这个问题应该是由来已久了,有所耳闻,也有过一些困惑,一直没有时间去追根究底。之前一直在Desktop上安装,不存在这个问题。

Ubuntu的电源管理是存在一些问题,这个bug也确实存在,而且在目前最新的Intrepid Ibex中依然没有解决!

事实上这个bug已经log了很久,在8.10中还是没有解决。好在,很多高人已经找到了多种解决方法。等不及Canonical官方fix的就看下去。

如何确定你有症状:
安装smartmontools,由此可以查看硬盘的SMART信息。

smartctl -a /dev/$disk | grep Load_Cycle_Count

$disk
SATA -> sda
PATA -> hda
以此类推

没有用修复之前,LCC每小时增长大概30-50不等,在不同的硬件上应该会不些差别。

root@linux:/etc/acpi# smartctl -a /dev/sda | grep Load_Cycle_Count
193 Load_Cycle_Count 0x0032 092 092 000 Old_age Always - 87399
root@linux:/etc/acpi# smartctl -a /dev/sda | grep Temp
194 Temperature_Celsius 0x0022 100 100 000 Old_age Always - 43 (Lifetime Min/Max 2/47)

这是我D620上的Count,在没用应用fix的情况下跑了大半年,看来影响并没有想象的那么大。从大多数硬盘的specification中得知,理论上LCC达到600000的时候,硬盘估计就报废了。

推荐的解决方法

临时方法:
用hdparm命令直接设置ATA硬盘的APM参数来避免LCC增加。这种方法可以通过terminal,pseudo console,ssh会话设置,重启即失效。

-B参数可用来查看和设置APM参数,数值1到127允许spin-down,128到254不允许spin-down。1表示最大限度利用电源管理节能,254则代表硬盘将以最高I/O性能模式运行。

root@ubuntu:~# hdparm -B 254 /dev/sda
/dev/sda:
setting Advanced Power Management level to 0xfe (254)
APM_level = 254

将ugly fix加入acpi脚本
1. 为使用电源和电池的时候定制不同的hdparm参数。你可能需要把/dev/sda修改成你的硬盘设备。

$sudo vi 99-hdd-ugly-fix.sh

内容
#!/bin/bash
if on_ac_power; then
# on AC so don't do any head parking
hdparm -B 254 /dev/sda # you might need 255 or a different value
else
# either on battery or power status could not be determined
# so quickly park the head to protect the disk
hdparm -B 192 /dev/sda
fi

2. 将如上脚本安装到以下4个目录,分别代表了AC电源,电池,从待机恢复和开机:
$sudo install 99-hdd-ugly-fix.sh /etc/acpi/ac.d/
$sudo install 99-hdd-ugly-fix.sh /etc/acpi/battery.d/
$sudo install 99-hdd-ugly-fix.sh /etc/acpi/resume.d/
$sudo install 99-hdd-ugly-fix.sh /etc/acpi/start.d/

这个方案比开启laptop mode简单且方便。

应用之后开机,LCC不会再增加了。自己心里还是舒服很多。Peace of mind…

此外Linuxtoy站上也有bread撰写的详细技术文章
Ubuntu中的Load/Unload Cycle Count问题及解决方案

附:
Mac OS X下查看SMART信息的方法:
需要下载安装免费工具smartctl,实际上是Linux下smartmontools的port,感谢作者:)

默认是启用smartctl-menu,如图:
smarttools

有时候smartctl会因为权限问题无法获取SMART信息,原因未知。这种情况下可以sudo后用命令行版本的smartctl:

terry:Resources terry$ /Applications/smartctl.app/Contents/Resources/./smartctl -a disk0 | grep Load_Cycle_Count
193 Load_Cycle_Count 0x0032 089 089 000 Old_age Always - 22405

更多参数可以看smartctl -h,若普通用户无法获取LCC,sudo -s输入密码用root权限执行。

Windows上可以用Everest或者HD Tune Pro查看Load_Cycle_Count
Everest

Related posts:

  1. 修复Mac OS X Load_Cycle_Count激增问题
  2. Ubuntu修复Load/Unload Cycle过于频繁的bug
  3. 对我们为什么要用Linux一文的补充
  4. iPhone上weDict使用免费Stardict字典
  5. U盘安装Mac OS X Snow Leopard

No Comments Now!

Be the first to comment on this entry.

Leave a comment

Name(required)
Mail (required),(will not be published)
Website(recommended)
Spam protection: Sum of 4 + 8 ?

Fields in bold are required. Email addresses are never published or distributed.

Some HTML code is allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre user="" computer="" escaped="">
URLs must be fully qualified (eg: http://terrywang.net),and all tags must be properly closed.

Line breaks and paragraphs are automatically converted.

Please keep comments relevant. Off-topic, offensive or inappropriate comments may be edited or removed.

    Search

      Loading

    Recent Posts