Disk shock protection interferes with standby timers, please advise

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi there,

Tomás Janousek has reported that the standby timer of his notebook hd is
not properly reenabled after a shock protection event. This is the
scenario:
1. Standby timer is initialised using hdparm -S ... and everything works
   as expected.
2. Until disk heads are being unloaded due to a shock protection event.
   Standby is prevented for as long as the request to unload_heads had
   indicated – still as expected.
3. The current implementation of shock protection issues a Check Power
   Mode command once the imminent danger is over. This was meant
   specifically to reenable the standby timer and used to work on the
   Hitachi drive I used for testing at the time. Alas, for some drives,
   including a Western Digital I have here at my disposal, that is not
   enough and they keep spinning until any command *but* Check Power
   Mode or Idle Immediate with Unload Feature is received.

Now, the ATA7 spec states that after receiving an Idle Immediate with
Unload Feature (section 6.20.10):

--8<---------------cut here---------------start------------->8---
The device shall stay at Low Power Idle mode, shall not go into Standby
mode and shall not load the head(s) onto the media until receiving a new
command.
[...]
The device shall retain data
in the write cache and resume writing the cached data onto the media
after receiving a Software Reset, a Hardware Reset, or any new command
except Idle Immediate with Unload Feature.
--8<---------------cut here---------------end--------------->8---

But then it says about the Check Power Mode command (section 6.8.8):

--8<---------------cut here---------------start------------->8---
The Check Power Mode command shall not cause the device to change power
or affect the operation of the Standby timer.
--8<---------------cut here---------------end--------------->8---

Hence, we should issue another command when the drive is not in standby
already in order to reenable the standby timer. Tomás suggested issuing
an Idle Immediate when Check Power Mode indicates that the disk is not
in standby already. Most obligingly, he even provided a patch to be
found at
<https://github.com/liskin/patches/blob/master/hacks/linux-3.3_hdaps-unprevent-standby.patch>.

My WD drive, however, gives a distinctly audible click when Idle
Immediate is issued after an Idle Immediate with Unload Feature. I rather
suspect that the heads are actively loaded again, which is undesirable.
This can easily be tested, even without applying Tomás' patch, by
executing the following commands:

# hdparm -S 1 /dev/sda
[disk spins down after 5 seconds]
# hdparm --idle-immediate /dev/sda
[spins up again]
# hdparm --idle-unload /dev/sda
[keeps spinning until another command reaches disk, reenabling standby timer]
# hdparm -C /dev/sda
[reenables standby timer depending on disk model/manufacturer]
# hdparm --idle-immediate /dev/sda
[definitely reenables standby timer but also loads heads (click sound)]

On the other hand,

# hdparm -I /dev/sda

also reenables the standby timer yet leaves the heads alone. So my
question is this: Can anyone give some advice as to what command what be
suitable to be issued instead of Idle Immediate when the shock
protection timeout has elapsed? Basically, it should be cheap, cause no
“mechanical action”, and be anything *but* Check Power Mode.

Thanks for your help in advance,

Elias
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux