i have two hdds in my system: one for normal work and a second one for backups. the second harddrive is put to sleep after startup and is only accessed, when my automatic backup scripts work around midnight. all partitions on aforesaid drive are unmounted, when it is not in use. when i trigger hibernate, the typical cursor blinking starts and after a few seconds the second hard drive is waken up, all hibernation data is put on the other harddisk and the pc shuts down. this wake up is clearly not related to the bios (there was a blacklisting patch to libata for a similar problem in 2008), but a kernel (libata? or other software) problem. something accesses the second harddrive in a way, that wakes it up unnecessarily, which potentially reduces its lifespan. the harddrive in question is a seagate 7200.8 (ST3250823AS) and is attached to a ICH10 southbridge (8086:3a22) on my intel DG45ID mainboard. i use smartd to monitor the other hdd only. the kernel is a precompiled 2.6.32.8 vanilla AMD64 kernel (from http://kernel.ubuntu.com/~kernel-ppa/mainline/v2.6.32.8/), but the problem is not new/a regression. the system runs ubuntu 9.10. dmesg does not give any hints. -- ameno
Hmmm.... yeah, that's the drive waking up to process the drive shutdown sequence - FLUSH followed by STANDBY. The driver has been intercepting command sequence and skipping those if the drive already seemed powered down in rather hacky way to work around buggy shutdown implementation. The shutdown implementation has been updated and thus the hacky workaround code was removed last year. The thing is that tracking device power state and buffer cleanliness from driver is messy and skipping FLUSH before cutting the power can be quite dangerous. It would be ideal if the drive don't spin up if there's no data to flush but it seems many drives do. At this point, I'm not quite sure what should be done about this. I'll think more about it. Thanks.
and the reason why this does not happen on a normal shutdown is that then the driver is not responsible for flushing itself but userspace? (sorry for the stupid question, but i have no idea how this is implemented :)
Hmmm.... not really, the sequence is about the same. It issues FLUSH and then STANDBY. So, even if the drive is in standby mode, it doesn't wake up during shutdown sequence?
correct. im not sure it was like that in 2.6.32 (because i rarely shutdown), but it is for sure in 2.6.33 now. i tested it yesterday and i cant hear anything from the second hdd while shutting down, when it was in SLEEP mode before (hdparm -Y).
Hmmm... Is the drive mounted? If so, can you unmount it and see whether that makes any difference? Thanks.
the drive is never mounted, when i shutdown or hibernate. the partition table looks like this: Disk /dev/sdb: 250.1 GB, 250059350016 bytes 255 heads, 63 sectors/track, 30401 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk identifier: 0x00049c61 Device Boot Start End Blocks Id System /dev/sdb2 32 30401 243947025 83 Linux (i had a small partition in the beginning once and did not reclaim that space) the entire sdb2 partition is a luks(dm)-encrypted ext3.
From what I can see, when the drive is in STANDBY, it does not wake up, but in SLEEP, it does because the FLUSH and STANDBY can not be sent to the drive while it is in SLEEP mode. My patches I posted to the mailing list recently fix this by faking the commands while the drive is in SLEEP mode. http://marc.info/?l=linux-ide&m=138403101124092&w=2
(if this is actually seen with a modern kernel please update the version!)
As my recent comment indicated, it still applies to current git head and bugzilla won't let me edit the version or status.