Hard Drive Active Protection System
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 do not 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 or greater to follow this guide.
- 1 Shock Detection
- 2 Shock Protection
- 3 GUI Utilities
- 4 See Also
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 is a set of drivers for many ThinkPad laptops. It is highly recommended if you have a supported ThinkPad, even if you do not plan to use HDAPS. Among a plethora of other useful things, tp_smapi represents the accelerometer output as joystick devices
/dev/input/js# (Note! This could interfere with other joystick devices on your system).
Install tp_smapi from the community repository. After installing, add
tp_smapi to a file
/etc/modules-load.d/tp_smapi.conf, assuming you are using systemd. After a reboot, this will activate most of the drivers, represented through the
The kernel provides its own HDAPS drivers. Previously, it was necessary to manually
insmod the module via
/etc/rc.local to prevent the default drivers from being loaded. The tp_smapi package from community now installs
hdaps.ko to /lib/modules/$(uname -r)/updates, which will let it supercede the built-in module. Thus, you can simply add
hdaps to your
invert module parameter
For some ThinkPads, the invert module parameter is needed in order to handle the X and Y rotation axes correctly. In that case, you can add the option in
options hdaps invert=1
invert=1 is an example value used for a ThinkPad T410. The invert option takes the following values:
- invert=1 invert both X and Y axes;
- invert=2 invert the X axes (uninvert if already both axes inverted)
- invert=4 swap X and Y (takes place before inverting)
Note that options can be summed. For instance, invert=5 swaps the axes and inverts them. The maximum value of invert is obviously 7. If you do not know which option is correct for you, just try them out with hdaps-gl or some other GUI (see below). Alternatively, you can determine the exact value for your thinkpad model from this table under the column labelled "HDAPS axis orientation".
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 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.
community/hdapsd with pacman. Be sure to review
/etc/conf.d/hdapsd to ensure that it is protecting the correct hard drive.
Method #1: systemd
When using systemd all you need to to is to enable and start the hdapsd daemon.
$ systemctl enable hdapsd $ systemctl start hdapsd
Method #2: /etc/rc.local
Because we have to load the hdaps module in
rc.local, which executes after the DAEMONS array is loaded, we have to put hdapsd in rc.local instead of in DAEMONS like usual. Modify
/etc/rc.local again, putting this line after the insmod added above:
# /etc/rc.d/hdapsd start
Method #3: /etc/rc.conf
The following constitutes the preferred startup method:
thinkpad_ecin the MODULES=() section of
hdapsdas a normal daemon in the DAEMONS=() section of
MODULES=(thinkpad_acpi thinkpad_ec acpi-cpufreq) DAEMONS=(hal hdapsd @network @alsa)
After following one of the methods either reboot or start the daemon manually with:
# /etc/rc.d/hdapsd start
Now, your computer will monitor the joystick devices and park your disk heads to protect it against shocks. If you find that the HDAPS protection is too sensitive, please edit the file
/etc/conf.d/hdapsd and adjust the sensitivity line. The default value is 15. The larger the number, the less sensitive HDAPS protection gets. The value 35 might be a good starting point.
After changing the values in this file you need to restart the hdapsd daemon:
# /etc/rc.d/hdapsd restart
You can check if HDAPS is working with:
$ sudo tail -f /var/log/messages.log
If you jiggle your laptop and HDAPS is active, you should see parking/un-parking messages. (You may also be able to hear the hard drive park. Do not do this too much!
Utilities exist to monitor hdapsd's status so you know what is going on while you are using your laptop. These are entirely optional, but very handy.
This is a GNOME panel applet (Note: XFCE can use GNOME panel applets) that represents the current status of your hard drive. There is already a PKGBUILD in AUR (see here). If you do not want to monitor sda or hda by default, edit the PKGBUILD before compiling.
A KDE version exists as well. khdapsmonitor in AUR (This project was abandoned and it is for KDE3). For KDE4 there is a version of plasmoid for HDAPS monitoring HDAPS applet. HDAPS-Monitor plasmoid is available in AUR.
This is a Xfce4 panel applet that can represents the current status of your hard drive. Available in AUR. After install, add this applet to a panel.
thinkhdaps A standalone GTK applet
A standalone GTK applet for HDAPS disk protection status. While running will show applet icon in the notification area. Available in AUR.
Simple OpenGL application showing the 3D animation of your Thinkpad. Similar to the apllication Lenovo distributes with Windows. hdaps-gl is available in AUR.