I have a Lenovo Thinkpad T400 with additional SATA harddrive instead of the DVD drive in it's Ultrabay. After installing tp_smapi and hdapsd and editing /etc/conf.d/hdapsd I wanted to start the deamon which didn't work. The init script only allows monitoring of one drive while the deamon itself can monitor several drives (see man page, option "-d"). Reproducible: Always Steps to Reproduce: 1. Get your hands on a laptop with HDAPS and a second HDD 2. Install hdapsd and dependencies, especially the external tp_smapi package instead of the kernel-internal hdaps interface. 3. Add second drive to DISK in /etc/conf.d/hdapsd: Chang DISK="sda" to DISK="sda sdb" or something similar. 4. Execute /etc/init.d/hdapsd start Actual Results: Starting the service fails as the init script can't handle multiple disks. /etc/init.d/hdapsd: line 15: [: /dev/sda: binary operator expected * No protect entry for sda sdb! * Make sure your kernel is patched with the blk_freeze patch Expected Results: Init script should handle multiple disks.
A workaround would be to change /etc/conf.d/hdapsd: Change OPTIONS="-a" to OPTIONS="-a -d sdb"
Created attachment 247998 [details] The new config file for monitoring multiple disks I just change the DISK option to DISKLIST option.
Created attachment 247999 [details] The initial script for hdapsd services With this script and the new config file, hdapsd can monitor multiple disks.
(In reply to comment #1) > A workaround would be to change /etc/conf.d/hdapsd: > > Change > OPTIONS="-a" > to > OPTIONS="-a -d sdb" > I just thought this might be a little ugly. It might be better that someone change the script file and config file in the portage tree.
(In reply to comment #2 & #3) DISKLIST works for me. I can choose either disk or both. Only the chosen one gets monitored. Can you put this into the portage tree? (In reply to comment #4) > I just thought this might be a little ugly. Yeah. That was just quick & dirty.
(In reply to comment #2 & #3) DISKLIST works for me. I can choose either disk or both. Only the chosen one gets monitored. Can someone put this into the portage tree and close the bug? (In reply to comment #4) > I just thought this might be a little ugly. Yeah. That was just quick & dirty.
Added in hdapsd-20090401-r1, please test!
Created attachment 296605 [details, diff] fixed init.d/hdapsd the initscript included with the hdapsd-20090401-r1.ebuild passes only the last device in the DISKLIST to hdapsd
Fixed, thanks!
I am using a modified version of the init script for a long time now. I also wanted it to support more than one disk. Yesterday i got -r1 which added this feature which i never reported. But the new init script is missing one important point. The second disk is usually sitting in the ultrabay and is removeable, meaning it is not always around. I hotswap the DVD drive and the disk. Whenever i insert a new device udev will restart hdapsd. My version of the init script will not fail if one of the disks on the list does not exist or does not support the unload feature. It will generate a warning and skip that disk. That way i can have both disks on the list and the init script will start hdapsd even if only one of the two is present. I will attach the script i am using. I did not report this bug because i thought not a lot of gentoo users would actually have a disk in the ultrabay, or care about it being monitored by hdapsd.
Created attachment 296659 [details, diff] diff agains files/hdapsd.init in the conf file DISK is simply a list, i did not rename it to DISKLIST DISK="sda sdb"
please reopen and let us get the new init script right so that it will not fail when one of the disks is not present
Thinking about it more carefully the list does not have to be there at all, because one could just look for the unload_heads file in all the the block device directories. If the script did that by default hdapsd would monitor all possible devices by default. Having a disklist conf variable might still be usefull for people that want to exclude devices for some reason.
Good point, I thought more about 2 disks in the laptop itself.
Henning, can you create a diff against hdapsd.init.2? Is there something else needed to make udev trigger a restart of hdapsd?
If no -d option is given hdapsd try to auto-detect devices. It looks for all devices in /sys/block/ for a device/unload_heads or queue/protect file. Additionally it checks if the file is removable or not and don't watch any removable devices. I think this would be a good default option. So no DISK variable and no selection in initscript is needed.
Incorporated auto-detecting support in hdapsd-20090401-r2.
We still need to trigger restart of hdapsd by udev if a disk was removed/added.
No response after 1 year, I changed to a different thinkpad with a ssd, so I don't use hdapsd anymore. Feel free to re-open if needed.