Difference between revisions of "How to protect the harddisk through APS"

From ThinkWiki
Jump to: navigation, search
(Adding kernel support)
m (Verifying hdapsd is working)
 
(56 intermediate revisions by 27 users not shown)
Line 3: Line 3:
 
|style="vertical-align:top" |
 
|style="vertical-align:top" |
 
This page tells you how to make the [[Active Protection System]] work under Linux to protect your harddrive from damage in case of a notebook drop or other kind of impact while it is running.
 
This page tells you how to make the [[Active Protection System]] work under Linux to protect your harddrive from damage in case of a notebook drop or other kind of impact while it is running.
|}
+
 
 +
Specific instructions for {{Fedora}} can be found [[Installing_Fedora_Core_5_on_a_ThinkPad_X41_Tablet#Harddrive_Active_Protection_System_.28HDAPS.29|here]].
 +
 
 +
For {{Debian}} (Etch) have a look at [[Installing_Debian_Etch_on_a_ThinkPad_Z60m#Active_Protection_System|this]].
  
 
== How APS works in Linux ==
 
== How APS works in Linux ==
 
APS in Linux consists of four components on the software side:
 
APS in Linux consists of four components on the software side:
* The [[HDAPS]] driver (included in recent kernels). (As a modul if you want to use tp_smapi (Gentoo-Linux))
+
* The [[HDAPS]] driver (included in recent kernels). It exports a sysfs interface providing the acceleration values.
* The <tt>hdaps_protect</tt> disk protection kernel patch (available [http://www.dresco.co.uk/hdaps/hdaps_protect.20060118.patch for kernel 2.6.15] and [http://www.dresco.co.uk/hdaps/hdaps_protect.20060409.patch for kernel 2.6.16]; see [[HDAPS#Disk_head_parking|here]] for other versions)
+
* The <tt>hdaps_protect</tt> disk protection kernel patch, which exports a sysfs interface that enables an ide or sata disk to be protected by a userspace process. You should get the patch appropriate to your kernel version from [http://news.gmane.org/group/gmane.linux.drivers.hdaps.devel/last=/force_load=t gmane.linux.drivers.hdaps.devel].
* The [http://www.dresco.co.uk/hdaps/hdapsd-20060409.c <tt>hdapsd</tt>] disk protection userspace daemon
+
** '''NOTE''': Starting with kernel 2.6.28 a generic disc protection feature is built into the libata driver
* Optional: the [http://www.oakcourt.dyndns.org/projects/khdapsmon/ <tt>khdapsmon</tt> KDE System Tray applet] or the [http://www.dresco.co.uk/hdaps/gnome-hdaps-applet-20060120.tar.gz <tt>gnome-hdaps-applet</tt>].
+
* The [http://sourceforge.net/projects/hdaps/ <tt>hdapsd</tt>] disk protection userspace daemon. It monitors the acceleration values through the HDAPS interface and automatically initiates disk protection through the hdaps_protect interface - given that the movement exceeds a user specified threshold.
 
+
* Optional: the [http://roy.marples.name/projects/khdaps/wiki <tt>khdapsmonitor KDE System Tray applet</tt>] or the [http://www.dresco.co.uk/hdaps/ <tt>gnome-hdaps-applet</tt>]. These applets provide a visual indication of the disk protection status and also a graphical interface for adjusting configuration options for <tt>hdapsd</tt>.
The [[HDAPS|HDAPS driver]] exports a sysfs interface providing the acceleration values.
+
|}
 
 
The <tt>hdaps_protect</tt> kernel patch exports a sysfs interface that enables an ide or sata disk to be protected by a userspace process.
 
 
 
The <tt>hdapsd</tt> userspace daemon monitors the acceleration values through the HDAPS interface and automatically initiates disk protection through the hdaps_protect interface - given that the movement exceeds a user specified threshold.
 
 
 
The optional KDE/GNOME applets provide a visual indication of the disk protection status and also a graphical interface for adjusting configuration options for <tt>hdapsd</tt>.
 
  
 
==Installation==
 
==Installation==
 
As mentioned above, the hdaps kernel driver found in recent kernels is only responsible for reading the accelerometer data and exporting it through the sysfs interface.  
 
As mentioned above, the hdaps kernel driver found in recent kernels is only responsible for reading the accelerometer data and exporting it through the sysfs interface.  
{{NOTE|1=If you use [[tp_smapi]], remember to include the option <tt>HDAPS=1</tt> when [[Tp_smapi#Installation|installing tp_smapi]].}}
+
 
 
In order to use this information to protect the disk, some additional steps are required.
 
In order to use this information to protect the disk, some additional steps are required.
  
Line 31: Line 28:
  
 
===Getting the files===
 
===Getting the files===
The latest versions of <tt>hdaps_protect</tt>, <tt>hdapsd</tt> and the <tt>gnome-hdaps-applet</tt> are available at [http://www.dresco.co.uk/hdaps]..
+
{| border="1" cellspacing="0" cellpadding="2"
 
+
! Latest Sources
<tt>khdapsmon</tt> can befound [http://www.oakcourt.dyndns.org/projects/khdapsmon/ here].
+
|
 
+
See [[HDAPS#Disk_head_parking|HDAPS - Disk head parking]]
{{Debian}} source and sid binary packages for <tt>hdapsd</tt> and the <tt>hdaps_protect</tt> patches (kernel-patch format) are available via APT access:
+
|-
 
+
! {{Slackware}}
deb http://www.oakcourt.dyndns.org/debian/ ./
+
|
deb-src http://www.oakcourt.dyndns.org/debian/ ./
+
*<tt>hdapsd</tt> SlackBuild: http://slackbuilds.org/repository/12.2/system/hdapsd/
 
+
|-
{{Fedora}} installation instructions are [[Installing_Fedora_Core_5_on_a_ThinkPad_X41_Tablet#Harddrive_Active_Protection_System_.28HDAPS.29|here]]
+
! {{Debian}}
 +
|
 +
*<tt>hdapsd</tt> package: http://packages.debian.org/unstable/misc/hdapsd
 +
|-
 +
! {{Fedora}}
 +
| see instructions [[Installing_Fedora_Core_5_on_a_ThinkPad_X41_Tablet#Harddrive_Active_Protection_System_.28HDAPS.29|here]]
 +
*kernel RPM packages including <tt>hdaps_protect</tt>: http://www.dresco.co.uk/hdaps/
 +
*kernel RPM packages including <tt>hdaps_protect</tt> and [[Software Suspend 2]]: http://mhensler.de/swsusp/download/yum/development/fc5/ (build 2084_2 and up)
 +
|-
 +
! {{Gentoo}}
 +
|
 +
*<tt>hdapsd</tt>: [http://sources.gentoo.org/viewcvs.py/gentoo-x86/app-laptop/hdapsd available]
 +
*<tt>khdapsmonitor</tt>: [http://sources.gentoo.org/viewcvs.py/gentoo-x86/app-laptop/khdapsmonitor available]
 +
|}
  
 
=== Adding kernel support ===
 
=== Adding kernel support ===
 
A kernel patch is required for disk head parking and queue freezing.
 
A kernel patch is required for disk head parking and queue freezing.
==== Fedora Core ====
 
 
Patched kernel RPM packages for {{Fedora}} are available [http://www.dresco.co.uk/hdaps/  here].
 
  
 
==== Manually patching and compiling a kernel ====
 
==== Manually patching and compiling a kernel ====
As root go to /usr/src/linux
+
As root, do:
 
+
:{{cmdroot|cd /usr/src/linux}}
{{cmdroot|patch -p1 < ~/hdaps_protect.20060409.patch}}
+
:{{cmdroot|patch -p1 < ~/hdaps_protect.20060409.patch}}
 
+
:{{cmdroot|make clean}}
{{cmdroot|make clean}}
+
:{{cmdroot|make}}
 
+
:{{cmdroot|make modules_install}}
{{cmdroot|make}}
 
 
 
{{cmdroot|make modules_install}}
 
 
 
==== Problem with unload capabilities check ====
 
 
 
You may get the following kernel message when the disk is protected (e.g., via {{cmdroot|echo 1 > /sys/block/sda/queue/protect}}):
 
 
 
ata_scsi_issue_protect_fn(): unload support NOT reported..
 
scsi_protect_queue(): head park not requested, used standby!..
 
 
 
or
 
 
 
idedisk_issue_protect_fn(): unload support NOT reported..
 
ide_protect_queue(): head park not requested, used standby!..
 
 
 
{{WARN|Using HDAPS in the above state may cause frequent drive spin downs, thereby wearing out your hard disk.}}
 
 
 
If you see this, and you are sure that your drive actually does support unloading (all original drives sold with HDAPS-equipped ThinkPads do), then do the following.
 
 
 
===== Solution for kernel 2.6.16 or later =====
 
 
 
The patch for 2.6.16 now accepts a module parameter to override the
 
parking capability detection.
 
 
 
Depending on your machine type, and whether the module is built into the kernel or not, you can use one of the following options:
 
  
If disk driver is built into kernel, add the following to your kernel boot parameters (e.g. /boot/grub/menu.lst):
+
==== Zen-Sources patched kernel ====
    libata.protect_method=1
+
Another way to achieve this is using zen-sources kernel.  
    ide-disk.protect_method=1
+
It has hdaps patches applied. Additional it supports many other IBM futures like tp_smapi and newest thinkpad_acpi.
  
If disk driver is built as module, the following to your modprobe configuration (e.g., /etc/modprobe.conf):
+
Download page for this kind of kernel is http://zen-sources.org/
    options libata protect_method=1
 
    options ide-disk protect_method=1
 
  
In both cases, if you know whether you use ide-disk or libata, you can drop the other line.
+
After downloading a kernel image unpack it to ''/usr/src/linux'' with
 +
:{{cmdroot|tar jxf zen-sources-2.6-version-zen0.tar.bz2 }}
  
The value <tt>1</tt> means "unload the head even if the drive doesn't report it has this capacility". The other values are <tt>2</tt> ("standby even if unload is supported") and <tt>0</tt> (autodetect).
+
Installation is similar to previous one.
  
===== Solution for kernel 2.6.15 and older =====
+
As root, do:
<pre>
+
:{{cmdroot|make oldconfig}}
diff -u linux-2.6.15.hdaps/drivers/ide/ide-disk.c linux-2.6.15.hdaps/drivers/ide/ide-disk.c
+
:{{cmdroot|make clean}}
--- linux-2.6.15.hdaps/drivers/ide/ide-disk.c 2006-01-18 07:11:54.000000000 +0000
+
:{{cmdroot|make}}
+++ linux-2.6.15.hdaps/drivers/ide/ide-disk.c 2006-01-18 07:11:54.000000000 +0000
+
:{{cmdroot|make modules_install}}
@@ -869,7 +869,7 @@
 
else
 
printk(KERN_DEBUG "idedisk_issue_protect_fn(): unload support NOT reported..\n");
 
 
- return ide_protect_queue(q, (drive->id->cfsse & (1 << 13)) ? 1: 0);
 
+ return ide_protect_queue(q, 1);
 
}
 
 
int idedisk_issue_unprotect_fn(request_queue_t *q)
 
diff -u linux-2.6.15.hdaps/drivers/scsi/libata-scsi.c linux-2.6.15.hdaps/drivers/scsi/libata-scsi.c
 
--- linux-2.6.15.hdaps/drivers/scsi/libata-scsi.c 2006-01-18 07:15:31.000000000 +0000
 
+++ linux-2.6.15.hdaps/drivers/scsi/libata-scsi.c 2006-01-18 07:15:31.000000000 +0000
 
@@ -661,7 +661,7 @@
 
printk(KERN_DEBUG "ata_scsi_issue_protect_fn(): unload support NOT reported..\n");
 
 
/* call scsi_protect_queue, requesting either unload or standby */
 
- return scsi_protect_queue(q, ata_id_has_unload(dev->id) ? 1 : 0);
 
+ return scsi_protect_queue(q, 1);
 
}
 
 
static int ata_scsi_issue_unprotect_fn(request_queue_t *q)
 
</pre>
 
  
===== Drives which have this problem =====
+
'''make oldconfig''' command will ask you for some information. It's required to tap '''m''' or '''y''' on "HDAPS" functionality, and on some other things connected with Thinkpad.
* Hitachi HTS726060M9AT00 (7K60) on ThinkPad {{T43}}
 
  
 
=== Installing hdapsd ===
 
=== Installing hdapsd ===
 
==== Manual compilation from source ====
 
==== Manual compilation from source ====
* Download the <tt>hdapsd</tt> sourcecode (see above)
+
{{NOTE|1=There has been a new release of hdapsd which doesn't use sysfs anymore and therefore reduces timer interrupts. You need tp_smapi 0.32 for this. See also: http://article.gmane.org/gmane.linux.drivers.hdaps.devel/1040 .}}
 +
* Download the <tt>hdapsd</tt> sources (see above)
 
* Compile using {{cmdroot|gcc -o hdapsd hdapsd-*.c}}
 
* Compile using {{cmdroot|gcc -o hdapsd hdapsd-*.c}}
 
* Run {{cmdroot|./hdapsd -d sda -s 12 -a}} (replace <tt>sda</tt> with your hard disk device; run {{cmdroot|./hdapsd}} without arguments for help)
 
* Run {{cmdroot|./hdapsd -d sda -s 12 -a}} (replace <tt>sda</tt> with your hard disk device; run {{cmdroot|./hdapsd}} without arguments for help)
 
==== Fedora Core ====
 
{{Fedora}} users can try the instructions [[Installing_Fedora_Core_5_on_a_ThinkPad_X41_Tablet#Harddrive_Active_Protection_System_.28HDAPS.29|here]]
 
  
 
==== Gentoo ====
 
==== Gentoo ====
Gentoo users can try this ebuild: http://bugs.gentoo.org/show_bug.cgi?id=119845
+
{{NOTE|1=hdapsd was added to the official portage tree on the 26th June 2006. However the version in portage is to be considered outdated. (20060409)}}
 
+
{{Gentoo}} users can try the ebuild attached to [http://bugs.gentoo.org/show_bug.cgi?id=166166 gentoo bug 166166].
For Gentoo: (works fine with IBM X41 25254CG)
+
*Add hdapsd support in your kernel: device drivers -> hardware monitoring -> ... (you need it as a module if you want to use tp_smapi and hdaps, see [[Tp_smapi]])
 
+
*Download the ebuild, use same ebuild date as the kernel-patch.
0.) Add hdapsd support in your kernel, as far as I can remember: device drivers -> hardware monitoring -> ... (you need it as modul if you want to use tp_smapi and hdaps, see tp_smapi topic)
+
*Make known the portage an extern ebuild path and add the following line to {{path|/etc/make.conf}}:
 
+
PORTDIR_OVERLAY="/usr/local/portage/" (or any other location)
1.) Download the ebuild, use same ebuild date as the kernel-patch
+
*Create directory {{path|/usr/local/portage}} and {{path|/usr/local/portage/app-laptop/}}
 
+
*Copy the downloaded ebuild to {{path|/usr/local/portage/app-laptop}} ({{path|/usr/local/portage/app-laptop/hdapsd}} should now exists)
2.) Makes known the portage an extern ebuild path and add the following line to /etc/make.conf:
+
*Make portage known the new ebuild and creat digist with:
 
+
:{{cmdroot|ebuild /usr/local/portage/app-laptop/hdapsd/hdapsd-20060326.ebuild digest}}
PORTDIR_OVERLAY="/usr/local/portage/" (or any other location)
+
*Optional: Copy source file to portage distfiles (if no internet connection is available):
 
+
:{{cmdroot|cp hdapsd-20060326.c /usr/portage/distfiles}}
3.) Creates directory /usr/local/portage and /usr/local/portage/app-laptop/
+
*Accept the x86 keyword for this package: {{cmdroot|echo "app-laptop/hdapsd ~x86" >> /etc/portage/package.keywords}}
 
+
*Install hdapsd with: {{cmdroot|emerge hdapsd}}.
4.) Copy downloaded ebuild to /usr/local/portage/app-laptop (/usr/local/portage/app-laptop/hdapsd should now exists)
+
*Edit {{path|/etc/conf.d/hdapsd}} (change your harddrive if neccessary: mine is sda, and change the value from 5, 5 is to sensitive, 12 is a good value in my opinion).
 +
*start deamon with: {{cmdroot|/etc/init.d/hdapsd start}}
 +
*Optional: add to default runlevel: {{cmdroot|rc-update add hdapsd default, rc-update add hdapsd battery}}
 +
Write an eMail to abartel[äd]htwm.de, if you want to get my hdapsd-20060326.ebuild and please upload it.
  
5.) Makes portage known the new ebuild and creat digist with:
+
==== Ubuntu ====
 
+
hdapsd is available via synaptic for Hardy Heron (9.04) and newer versions.
ebuild /usr/local/portage/app-laptop/hdapsd/hdapsd-20060326.ebuild digest
 
 
 
6.) Optional: Copy source file to portage distfiles (if no internet connection is available):
 
 
 
cp hdapsd-20060326.c /usr/portage/distfiles
 
 
 
7.) Accept the x86 keyword for this package: echo "app-laptop/hdapsd ~x86" >> /etc/portage/package.keywords
 
 
 
8.) Install hdapsd with: emerge hdapsd
 
 
 
9.) Edit the /etc/conf.d/hdapsd file (change your harddrive if neccessary: my is sda, and change the value from 5, 5 is to sensitive, 12 is a good value in my opinion)
 
 
 
10.) start deamon with: /etc/init.d/hdapsd start
 
 
 
11.) Optional: add to default runlevel: rc-update add hdapsd default, rc-update add hdapsd battery
 
 
 
 
 
Write me an e-mail (abartel[äd]htwm.de), if you want to get my hdapsd-20060326.ebuild and please upload it (It's illagal from work)
 
  
 
=== Building an applet ===
 
=== Building an applet ===
 +
====hdaps-gl====
 +
*Make sure you have installed hdaps [and loaded] and ?opengl?
 +
*Download [https://sourceforge.net/project/showfiles.php?group_id=138242 hdaps-gl-0.0.5] from the web.
 +
*Extract files to {{path|/opt/hdaps-gl}}.
 +
*{{cmdroot|make}}
 +
*Start the applet: {{cmdroot|./hdaps-gl}}
  
{{Fedora}} users can try the instructions [[Installing_Fedora_Core_5_on_a_ThinkPad_X41_Tablet#Harddrive_Active_Protection_System_.28HDAPS.29|here]]
+
==Verifying hdapsd is working==
 
+
According to instructions from the [http://sourceforge.net/mailarchive/message.php?msg_name=h5r1f4%246s8%241%40ger.gmane.org hdaps-devel mailing list]:
0.) Make sure you have installed hdaps [and loaded] and ?opengl?
 
 
 
1.) Download hdaps-gl-0.0.5 from the www
 
 
 
2.) Extract files to /opt/hdaps-gl
 
 
 
3.) {{cmdroot|make}}
 
 
 
4.) Start applett {{cmdroot|./hdaps-gl}}
 
 
 
====Building khdapsmon====
 
Where is Gentoo ebuild http://bugs.gentoo.org/show_bug.cgi?id=124175.
 
 
 
====Building gnome-hdaps-applet====
 
  
{{Fedora}} users can try the instructions [[Installing_Fedora_Core_5_on_a_ThinkPad_X41_Tablet#Harddrive_Active_Protection_System_.28HDAPS.29|here]]
+
Start {{cmdroot|find /}} in a terminal and move your laptop.  The output should stop while moving (while the heads are parked). When you do this, make sure you do not have any external usb drives. If so it could look like it is not parking the drive while you do this (i.e. it wont park the external and since find is run over the external too, it can continue the find command there).
  
 +
Alternatively, run {{cmdroot|while true; do cat /sys/block/sda/device/unload_heads; done}} (replacing <tt>sda</tt> with your device) and move the laptop.  When the value is greater than zero the heads are parked.
  
{{Todo|tell people what to do}}
+
==Troubleshooting==
 +
See the [[Problem with APS harddisk parking]] page for troubleshooting APS issues.
 +
{{NOTE|1=If you use [[tp_smapi]], remember to include the option <tt>HDAPS=1</tt> when [[Tp_smapi#Installation|installing tp_smapi]]. Also, you might need to build the hdaps driver as module.}}
  
 
==Further Information==
 
==Further Information==
Line 200: Line 135:
  
  
[[Category:R50]] [[Category:R50p]] [[Category:R51]] [[Category:R52]] [[Category:T41]] [[Category:T41p]] [[Category:T42]] [[Category:T42p]] [[Category:T43]] [[Category:T43p]] [[Category:T60]] [[Category:X40]] [[Category:X41]] [[Category:X41 Tablet]] [[Category:X60]] [[Category:X60s]] [[Category:Z60m]] [[Category:Z60t]]
+
[[Category:R50]] [[Category:R50p]] [[Category:R51]] [[Category:R52]] [[Category:T41]] [[Category:T41p]] [[Category:T42]] [[Category:T42p]] [[Category:T43]] [[Category:T43p]] [[Category:T60]] [[Category:T60p]] [[Category:T61]] [[Category:X40]] [[Category:X41]] [[Category:X41 Tablet]] [[Category:X60]] [[Category:X60s]] [[Category:Z60m]] [[Category:Z60t]] [[Category:Z61m]] [[Category:Z61e]] [[Category:Z61m]]

Latest revision as of 18:56, 1 May 2011

This page tells you how to make the Active Protection System work under Linux to protect your harddrive from damage in case of a notebook drop or other kind of impact while it is running.

Specific instructions for Fedora can be found here.

For Debian (Etch) have a look at this.

How APS works in Linux

APS in Linux consists of four components on the software side:

  • The HDAPS driver (included in recent kernels). It exports a sysfs interface providing the acceleration values.
  • The hdaps_protect disk protection kernel patch, which exports a sysfs interface that enables an ide or sata disk to be protected by a userspace process. You should get the patch appropriate to your kernel version from gmane.linux.drivers.hdaps.devel.
    • NOTE: Starting with kernel 2.6.28 a generic disc protection feature is built into the libata driver
  • The hdapsd disk protection userspace daemon. It monitors the acceleration values through the HDAPS interface and automatically initiates disk protection through the hdaps_protect interface - given that the movement exceeds a user specified threshold.
  • Optional: the khdapsmonitor KDE System Tray applet or the gnome-hdaps-applet. These applets provide a visual indication of the disk protection status and also a graphical interface for adjusting configuration options for hdapsd.

Installation

As mentioned above, the hdaps kernel driver found in recent kernels is only responsible for reading the accelerometer data and exporting it through the sysfs interface.

In order to use this information to protect the disk, some additional steps are required.

  • Download and build the latest hdaps_protect disk protection kernel patches.
  • Enable the drivers in the kernel (requires kernel rebuild).
  • Download, build and configure the hdapsd userspace daemon.
  • Download and build one of the applets to get a real-time representation of the disk protection status.

Getting the files

Latest Sources

See HDAPS - Disk head parking

Slackware
Debian
Fedora see instructions here
Gentoo

Adding kernel support

A kernel patch is required for disk head parking and queue freezing.

Manually patching and compiling a kernel

As root, do:

# cd /usr/src/linux
# patch -p1 < ~/hdaps_protect.20060409.patch
# make clean
# make
# make modules_install

Zen-Sources patched kernel

Another way to achieve this is using zen-sources kernel. It has hdaps patches applied. Additional it supports many other IBM futures like tp_smapi and newest thinkpad_acpi.

Download page for this kind of kernel is http://zen-sources.org/

After downloading a kernel image unpack it to /usr/src/linux with

# tar jxf zen-sources-2.6-version-zen0.tar.bz2

Installation is similar to previous one.

As root, do:

# make oldconfig
# make clean
# make
# make modules_install

make oldconfig command will ask you for some information. It's required to tap m or y on "HDAPS" functionality, and on some other things connected with Thinkpad.

Installing hdapsd

Manual compilation from source

NOTE!
There has been a new release of hdapsd which doesn't use sysfs anymore and therefore reduces timer interrupts. You need tp_smapi 0.32 for this. See also: http://article.gmane.org/gmane.linux.drivers.hdaps.devel/1040 .
  • Download the hdapsd sources (see above)
  • Compile using # gcc -o hdapsd hdapsd-*.c
  • Run # ./hdapsd -d sda -s 12 -a (replace sda with your hard disk device; run # ./hdapsd without arguments for help)

Gentoo

NOTE!
hdapsd was added to the official portage tree on the 26th June 2006. However the version in portage is to be considered outdated. (20060409)

Gentoo users can try the ebuild attached to gentoo bug 166166.

  • Add hdapsd support in your kernel: device drivers -> hardware monitoring -> ... (you need it as a module if you want to use tp_smapi and hdaps, see Tp_smapi)
  • Download the ebuild, use same ebuild date as the kernel-patch.
  • Make known the portage an extern ebuild path and add the following line to /etc/make.conf:
PORTDIR_OVERLAY="/usr/local/portage/" (or any other location)
  • Create directory /usr/local/portage and /usr/local/portage/app-laptop/
  • Copy the downloaded ebuild to /usr/local/portage/app-laptop (/usr/local/portage/app-laptop/hdapsd should now exists)
  • Make portage known the new ebuild and creat digist with:
# ebuild /usr/local/portage/app-laptop/hdapsd/hdapsd-20060326.ebuild digest
  • Optional: Copy source file to portage distfiles (if no internet connection is available):
# cp hdapsd-20060326.c /usr/portage/distfiles
  • Accept the x86 keyword for this package: # echo "app-laptop/hdapsd ~x86" >> /etc/portage/package.keywords
  • Install hdapsd with: # emerge hdapsd.
  • Edit /etc/conf.d/hdapsd (change your harddrive if neccessary: mine is sda, and change the value from 5, 5 is to sensitive, 12 is a good value in my opinion).
  • start deamon with: # /etc/init.d/hdapsd start
  • Optional: add to default runlevel: # rc-update add hdapsd default, rc-update add hdapsd battery

Write an eMail to abartel[äd]htwm.de, if you want to get my hdapsd-20060326.ebuild and please upload it.

Ubuntu

hdapsd is available via synaptic for Hardy Heron (9.04) and newer versions.

Building an applet

hdaps-gl

  • Make sure you have installed hdaps [and loaded] and ?opengl?
  • Download hdaps-gl-0.0.5 from the web.
  • Extract files to /opt/hdaps-gl.
  • # make
  • Start the applet: # ./hdaps-gl

Verifying hdapsd is working

According to instructions from the hdaps-devel mailing list:

Start # find / in a terminal and move your laptop. The output should stop while moving (while the heads are parked). When you do this, make sure you do not have any external usb drives. If so it could look like it is not parking the drive while you do this (i.e. it wont park the external and since find is run over the external too, it can continue the find command there).

Alternatively, run # while true; do cat /sys/block/sda/device/unload_heads; done (replacing sda with your device) and move the laptop. When the value is greater than zero the heads are parked.

Troubleshooting

See the Problem with APS harddisk parking page for troubleshooting APS issues.

NOTE!
If you use tp_smapi, remember to include the option HDAPS=1 when installing tp_smapi. Also, you might need to build the hdaps driver as module.

Further Information

  • Additonal information and support is available through the hdaps-devel mailinglist and its archive.