HddCycles
This page describes how to check for and fix excessive hard disk drives load/unload cycles count as explained in the Asus UL Series page. Instructions applies to either Ubuntu 9.10 (Karmic Koala) or 10.04 (Lucid Lynx), and may work with other versions.
Check Potential Issue
The smartctl tool is needed to check if a particular hard disk is concerned. It requires the smartmontools package to be installed.
Check procedure:
- Go to battery power (unplug the computer from AC power)
Open up a Terminal window (Accessories > Terminal)
Run command:
sudo smartctl -a /dev/sda | grep Load_Cycle_Count
which will result in an output like:
193 Load_Cycle_Count 0x0012 100 100 000 Old_age Always - 2221
The last column number (2221 in this example) is the current load/unload cycles count.- Wait 4 minutes
Run the same command again:
sudo smartctl -a /dev/sda | grep Load_Cycle_Count
- The load/unload cycles count should not increase more than 1 cycle every 2 minutes (modern drives are generally rated for about 600.000 cycles, giving about 4 years of lifetime using it 12 hours a day with about 30 cycles per hour). As an example, an Asus UL30A with Hitachi 320 Go drive has been verified with about 4 load/unload cycles per minute with default settings, which should be considered too much.
Fix the Issue
There are notably two different ways to fix that issue. The first one involves using the hdparm tools directly, the other being using Laptop Mode Tools.
Fixing the load/unload cycles count may:
- Reduce the battery autonomy (the hard disk being kept powered more frequently)
Raise the hard disk temperature. This may be checked with the hddtemp tool (requires hddtemp package to be installed):
sudo hddtemp /dev/sda
As a general rule, temperature should not go over 39 to 43°C with various hardware.
The Direct Way
The direct way uses hdparm to prevent the hard disk drive from parking too frequently, or from parking at all (1 load/unload cycle per power-on/off or resume cycle) depending on settings values.
Using the direct way will require to disable the Laptop Mode Tools.
Trying the Direct Way
In Gnome Power Manager (System > Preferences > Power manager), uncheck "Spin down Hard Disks when possible" setting in "AC Power" and "Battery" tabs
Deactivate Laptop Mode if enabled: install bum package (Boot-Up Manager), run System > Administration > Boot-Up Manager, find if the "laptop-mode" line is present, uncheck "laptop-mode" (so that it will not be loaded during boot), apply, confirm with "Yes" ("laptop-mode" will be immediately stopped) and quit
Install hdparm package if required
Open up a Terminal window (Accessories > Terminal)
Run
sudo hdparm -B 254 /dev/sda
- Check (on battery power) that the issue is fixed
The 254 value in sudo hdparm -B 254 /dev/sda is extreme and will result in the less aggressive power management setting: very few load/unload cycles, but battery autonomy may be reduced. You may want to tweak this value according to your hardware: as a general rule, values from 192 to 254 are known to give the best results
In case the issue is not fixed, try with:
sudo hdparm -B 254 -S 242 /dev/sda
The -S 242 option tells the drive not to spin down before 1 hour (has been observed to be required on some Sony Vaio notebooks).
As an example, with an Asus UL30A, Hitachi 320 Go drive, changes are as follows:
- Default load/unload cycles were 4 per minute (too much), with about 10 hours of battery autonomy, with Wi-Fi on and a wireless mouse USB dongle.
- With "-B 254" hdparm setting, load/unload cycles lowers to 1 per power-on/off (or resume) cycle, while battery autonomy goes to about 9 hours in the same conditions. Hard disk drive temperature keeps around 32°C under average use.
Making it Permanent
If the hdparm direct way works, it is needed to make it permanent as settings will be lost at each boot. To do so:
Open up a Terminal window (Accessories > Terminal)
Run
sudo gedit /etc/pm/power.d/99-hddfix
Paste the following code:
hdparm -B 254 /dev/sda
Note that sudo is no more present, as this script will be run by the system with root privileges. You may adapt the "-B 254" value with any better tested value.
- Save and close gedit
Make the script executable:
sudo chmod +x /etc/pm/power.d/99-hddfix
Copy the script to the "resume" location:
sudo cp /etc/pm/power.d/99-hddfix /etc/pm/sleep.d
- Reboot, and do the checking procedure again (on battery power), then try to suspend and/or hibernate, awake the computer and check again.
Laptop Mode Tools
Laptop Mode may also be tweaked to control the hard disk drive power management features to fix this issue.
Instructions and settings relevant to an Asus UL30 model (likely applicable to various hardware) are available in the Asus U/UL Series Launchpad Team mailing-list archive.
AsusUL/HddCycles (last edited 2010-06-04 10:02:06 by ip-163-225)