hdapsd - Hard Drive Active Protection System Daemon
This is a disk protection user-space daemon. It monitors the acceleration values through the various motion interfaces and automatically initiates disk head parking if a fall or sliding of the laptop is detected.
Currently, the following motion interfaces are supported:
- HDAPS on IBM/Lenovo ThinkPads
- AMS on Apple iBooks and PowerBooks (G4)
- FREEFALL on Hewlett-Packard and DELL laptops
- HP3D on Hewlett-Packard laptops
- APPLESMC on Apple MacBooks and MacBooks Pro (Intel) (UNTESTED!)
- Toshiba HAPS and Toshiba ACPI on Toshiba laptops (UNTESTED!)
- Generic input/joystick on ACER laptops (UNTESTED!)
./configure make make install
The following parameters to
./configure are probably interesting:
--with-systemdsystemunitdirlets you specify the directory for systemd unit files. It defaults to the output of
pkg-config --variable=systemdsystemunitdir systemd.
--with-udevdirlets you specify the directory for udev rules files. It defaults to the output of
pkg-config --variable=udevdir udev.
In most cases, just running
hdapsd as root should be enough, as it will
try to autodetect everything itself.
If you want to adjust stuff, these are the most commonly used options:
--cfgfilewhich allows to load a configuration from a file.
--devicewhich device to protect, e.g.
--device=sda. Defaults to autodetection of all rotating devices.
--sensitivityadjusts the sensitivity of the algorithmus. Defaults to 15.
--adaptiveenables adaptive mode, where
hdapsdadjusts the sensitity while the mouse and keyboard are used.
hdapsdinto the background as a daemon.
For more options, please read
systemd and udev integration
hdapsd comes with
udev integration. This means when those two
are found on your system,
installed and used.
udev will start one
hdapsd instance for each
rotational, non-removable disk it finds.
If you want to disable this automation for a certain disk, you can mask
systemd unit by calling:
systemctl mask hdapsd@sdX
If you want to disable this automation at all, you can create an empty
/etc/udev/rules.d/hdapsd.rules, which will override the system-installed
udev rule. You can still enable
hdapsd for certain devices by creating
hdapsd@sdX.service symlinks in
If you want to customize the parameters
hdapsd is using, you can edit
/etc/hdapsd.conf (preferred) or by customizing
As an alternative, you could also use
misc/hdapsd.service, which you'd
have to install yourself. This unit will just start
hdapsd the same way
sysvinit would do.
Since kernel 2.6.28 you don't need to patch your kernel, as support for IDLE_IMMEDIATE is present in mainline.
NOTE: The new interface only allows IDLE_IMMEDIATE for drives that
announce to be ATA-7 conform. But threre are also drives that support ATA-6
only but do IDLE_IMMEDIATE fine. For those you need to force the interface
echo -1 > /sys/block/$DISK/device/unload_heads.
Or you can call
hdapsd like this:
hdapsd -f -d $DISK, to achieve the same
For kernels <2.6.28, please have a look at
and patch your kernel with the appropriate patch before using
mainline hdaps module vs tp_smapi (ThinkPad only)
The mainline hdaps module present in Linux kernels does not support all
hdaps-enabled ThinkPads, thus it is recommended to use the one provided
Additionally the tp_smapi version provides an input interface to the data,
hdapsd from polling the data itself all the time, saving your