Problem with APS harddisk parking

From ThinkWiki
Jump to: navigation, search

When trying to enable APS functionality by installing hdaps_protect and hdapsd, the following problems might occur.

Problem with unload capabilities check

You may get the following kernel message when the disk is protected (e.g., via # 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!..
ATTENTION!
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), one of the following solutions might help.

Drives which have this problem

Solution for kernel 2.6.16 or later

The hdaps_protect patch for 2.6.16 now accepts the protect_method module parameter to override the parking capability detection, which accepts the following numeric values:

  • 0: autodetect capability
  • 1: "unload the head even if the drive doesn't report it has this capability"
  • 2: "standby even if unload is supported"

Hence, 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):

   libata.protect_method=1
   ide-disk.protect_method=1

If disk driver is built as module, add the following to your modprobe configuration (e.g., /etc/modprobe.conf):

   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.

Solution for kernel 2.6.15 and older

The following patch overrides automatic protect capability detection.

diff -u linux-2.6.15.hdaps/drivers/ide/ide-disk.c linux-2.6.15.hdaps/drivers/ide/ide-disk.c
--- linux-2.6.15.hdaps/drivers/ide/ide-disk.c	2006-01-18 07:11:54.000000000 +0000
+++ linux-2.6.15.hdaps/drivers/ide/ide-disk.c	2006-01-18 07:11:54.000000000 +0000
@@ -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)

Problem with hard drive firmware

Drivers other than those sold by IBM for APS-equipped ThinkPads may lack the head unload command.

Detection

If you see the following message in # dmesg output after you have started the hdaps daemon, your drive lacks the unload feature (the converse is not true).

ide_protect_queue(): head NOT parked!.. 
ide_unprotect_queue(): No pending I/O, re-enabling power management..

You can also directly test for the head unload function by running the following Perl script:

#!/usr/bin/perl
# Unload disk head on drives that support IDLE IMMEDIATE with the UNLOAD feature.
$dev="$ARGV[0]" or die "Specify device as argument.\n";
$HDIO_DRIVE_TASK=0x031e;
$args=pack("ccccccc",0xe1,0x44,0,0x4C,0x4E,0x55,0);
open(DEV,"<",$dev) or die "open(\"$dev\"): $!\n";
ioctl(DEV,$HDIO_DRIVE_TASK,$args) or die "Unload failed: $!\n";

Due to a limitation of the Linux kernel libata system, it is not possible for this program to check if the unload worked. You'll have to listen for the characteristic sound (a faint click and a change in spinning sound) to learn if the unload worked.

Solutions

A firmware upgrade of your harddisk might add the missing function.

Go to the IBM harddrive firmware update utility page and check if a firmware upgrade is available for your harddisk. IBM/Lenovo provides a bootdisk for easy firmware upgrade (~17MB download).

Supported/unsupported harddrive firmwares

Use # hdparm -i /dev/hda to get your harddisk model name and firmware version (replace /dev/hda with the actual device for your hard drive). On newer models, you need # sdparm -i /dev/sda (or # hdparm -I /dev/sda ) because of the SATA controller.

The following line is the important one in the output:

Model=HTS726060M9AT00, FwRev=MH4OA6GA, SerialNo=MRHXXXXXXXXX

The last four characters of the FwRev actually marks the firmware version.

The table lists known working / not working firmware versions with HDAPS

Drive firmware park command output Source
IC25N040ATCS04-0 CA40A71A not parked
IC25N040ATMR04-0 MO2OAD4A not parked
IC25N040ATMR04-0 MO2OADEA not parked
HITACHI HTC426040G9AT00 00P4A0B4 parked
HITACHI HTC426060G9AT00 00P3A0B4 parked (method=1)
HITACHI HTS548040M9AT00 MG20A5BA not parked
HITACHI HTS548040M9AT00 MG20A5HA parked
HITACHI HTS548040M9AT00 MG2OA5PA parked
HITACHI HTS548080M9AT00 (TBA) parked
HITACHI HTS541060G9AT00 MB3IA60A parked
HITACHI HTS726060M9AT00 MH4OA6GA parked
HITACHI HTS722016K9SA00 DCDZC75A parked, and specs mention UNLOAD capability
Fujitsu MHT2040AH 846C parked, and specs mention UNLOAD capability
Fujitsu MHT2040AH 8471 parked, and specs mention UNLOAD capability
Fujitsu MHV2060AH/MHV2100AH/MHV2120AH specs mention UNLOAD capability
Fujitsu MHV2120BH PL 0084002A parked Lenovo
Fujitsu MHY2250BH 0084000D parked (work fine) Lenovo
Fujitsu MHY2320BH G1 parked
Seagate ST9160821A (160GB PATA) 5MAATJHL parked (and reports UNLOAD capability)
Seagate ST9500325AS (500GB SATA) 0001SDM1 parked (specs mention UNLOAD capability + QuickStep)
Seagate ST9500420AS (500GB SATA) 0003LVM1 parked
Western Digital WD1600BEKT-00F3T0 11.1A11 parked (and hdparm reports UNLOAD capability)