Hard Drive Active Protection System

From ArchWiki
Revision as of 22:25, 19 January 2009 by ColdPie (talk | contribs) (New page: This page describes how to install HDAPS on your Arch Linux installation. HDAPS stands for "Hard Drive Active Protection System." Its purpose is to protect your hard drive from sudden sh...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This page describes how to install HDAPS on your Arch Linux installation. HDAPS stands for "Hard Drive Active Protection System." Its purpose is to protect your hard drive from sudden shocks (such as dropping or banging your laptop on a desk). It does this by parking the disk heads, so that shocks don't cause them to crash into the drive's platters. Hopefully, this will prevent catastrophic failure.

As of Linux 2.6.28, the kernel has the ability to park disk heads on demand. Previously, this had to be patched into the kernel. Thanks to the kernel devs' hard work, we no longer have to rebuild our kernel to use this feature. Obviously, this means you need to be running 2.6.28 to follow this guide.

Shock Detection

Your hardware needs to support some kind of shock detection. This is usually in the form of an accelerometer built into your laptop's motherboard. If you have the hardware, you also need a way to communicate what the hardware is detecting to your operating system. This section describes drivers to communicate the accelerometer's state to the OS so it can detect and protect against shocks.

tp_smapi

tp_smapi is a set of drivers for ThinkPad laptops. Among a plethora of other useful things, tp_smapi represents the accelerometer output as joystick devices /dev/js# (Note! This could interfere with other joystick devices on your system). tp_smapi is highly recommended if you have a ThinkPad, even if you don't plan to use HDAPS.

Install tp_smapi from AUR. After installing, add tp_smapi to your MODULES array. After a reboot, this will activate most of the drivers, represented through the /sys/devices/platform/smapi filesystem.

The kernel provides its own HDAPS drivers. For this reason, the HDAPS part of tp_smapi is built separately. Attempting to add hdaps to your MODULES array will result in the default drivers being loaded. This is not what we want, as we have our special ThinkPad HDAPS drivers. Instead, modify your /etc/rc.local and add the following line:

insmod /lib/modules/2.6.28-ARCH/extra/hdaps.ko

This will load the ThinkPad HDAPS module at the end of the initialization sequence.

Shock Protection

Now that your hardware is reporting its shock detection to the OS, we need to do something with this data. This section describes software utilities to transform the sensor output into shock protection.

hdapsd

hdapsd monitors the output of the HDAPS joystick devices to determine if a shock is about to occur, then tells the kernel to park the disk heads.

Install hdapsd from AUR. After installing, add hdapsd to your DAEMONS array. Also be sure to review /etc/conf.d/hdapsd to ensure that it's protecting the correct hard drive. After a reboot, your computer will now monitor the joystick devices and park your disk heads to protect it against shocks.

Reboot your computer at this point.

GUI Utilities

Utilities exist to monitor hdapsd's status so you know what's going on while you're using your laptop. These are entirely optional, but very handy.

gnome-hdaps-applet

This is a GNOME panel applet (Note: XFCE can use GNOME panel applets) that represents the current status of your hard drive. If the disk heads are parked by hdapsd, this applet will reflect that. Unfortunately, the AUR project for gnome-hdaps-applet is very out of date and does not work any longer. This should be fixed, but for now, here's how to do it manually. Note that pacman will not manage these files. If you update this applet later, you'll have to manually remove and replace these files.

First, grab the latest gnome-hdaps-applet sources from the this HDAPS mirror. As of this writing, this is version 20081204. Inflate these files, and follow the instructions in INSTALL. It's very straight-forward. When you're done, keep the INSTALL file around for future reference if you have to update or uninstall the applet later. Again, remember that pacman will not manage these files for you in any way.

khdapsmonitor

A KDE version exists as well. khdapsmonitor in AUR. (Someone who uses KDE, please research and update this section.)

See Also

How to protect the harddisk through APS at ThinkWiki

HDAPS at ThinkWiki