hd-idle unable stop hdd's after some time.
Brought to you by:
cjmueller
Hi, I try your tool. Its working as intended for first some hours. But than HDD's spin up again and program cannot stop them.
It can stop my hdd's If I restart hd-idle.
I don't know what is the bug, I think think program cannot detect spin ups.
Program prints read/write bytes to stdout if run in debug mode. I don't inspect your code but insist that you are catching hdd activity by reading last r/w time.
Might be this is something related with smart interface commands that doesn't write/read from hdd's.
Using OpenSuSE 11.2 x86_64 with vanilla kernel 2.6.33.
Thanks.
Hi again. I am in same situation but here is more information.
My hdd's spinning. When I enter inside them and read some bytes. After 5 secconds (I set it for -i 5) it turns of.
So problem is that program assumes that if HDD was spin down by itself and there is no read/write operation on it, that it is in spin down already. Which is not correct assumption for every time.
My proposition is trying to detect HDD's current state with more accurate command like "hdparm -C /dev/sda". So program can detect that if hdd spin up by another program and could stop it again...
Thanks.
Erdem
Sorry for the delay -- I'm not checking those forums as often as I should. Hd-idle basically monitors the disk stats to see how many blocks have been read or written. Once the stats remain constant for the configure idle time, the disk is spun down. When the disk stats indicate further I/O, the timer is reset and, optionally, an entry is written to the log file. This should be foolproof -- at least I can't imagine a reason why this should stop working after a while.
It's also very unlikely that the handle to the disk subsystem stalls afrer a few hours because the disk is opened each time it's about to be spun down, then closed right after sending the spindown command.
Can you see anything in dmesg which would be of any help?
Other than that, the only explanation is that there's frequent I/O, e.g. because of writes to files in /var/log, which prevents the disk from being idle long enough to spin down.
Thanks,
--Christian
No I used this program for another HDD that has no active partition in it. So this bug is not related by usage of HDD,
And yes, there is "no error at program", at least at code. But It's on your algorithm. Because users/system could perform I/O without read or writing to blocks... Like Smart data, trying to detect temperature of HDD. Or any other internal system commands...
I searched some and find an alternative command to suspends HDD's spin. It's just hdparm idle setting.
Now I am using "hdparm -S 12 /dev/sd*" command. And it's free of this bug, makes sleep my HDD if there is no I/O for a minute. Also don't require to run in memory as a daemon. I don't understand why do you code this "hd-idle" program since there is perfect solution is already available... Or do you know existence of such a command? If you know this command, Why do you code it for? What is "hd-idle" difference? (except this bug)
Thanks
I wonder why do you write such an application for linux since hd-parm makes it's job perfect and available on every distro by default...
Sorry for the delay -- I haven't been checking the bug reports for quite a while. Yes, SMART commands might indeed be responsible for the behavior. There's no simple way to detect whether a disk is currently spinning without accessing the disk and the primary use case for hd-idle, USB-attached disks, won't support smart commands, anyway, so checking the IO stats is usually sufficient.
Since you're able to use SMART commands, it seems you have direct access to the IDE/ATA controller of the drive. Is there a reason why you use hd-idle in this case vs. setting an IDE idle timeout? Or are you using hd-idle on a SCSI/SAS disk?
Thanks,
--Christian
Oops -- just realized there were already comments, even from me ;) Again, if you have direct access to the IDE/ATA controller, you can use hdparm to set up the HW idle timer. hd-idle was meant for USB-attached disks where hdparm won't work, thus there's no way to set the HW idle timer.
Can this defect be closed? Or am I missing something?
Thanks,
--Christian
I am just using HD parm with custom script for year :)
Regards