Guide: How-to setup 'hd-idle' (a HDD spin down SW) together with the OMV plugin 'Autoshutdown'.

  • --- For OMV V5.x please see here. ---


    I have read an learned a lot during my one week try and error sessions with my new OMV 2.2.13 system (with kernel 3.16.0-0.bpo.4-amd64). After I got my SnapRAID configuration running I tried to fine tune my little system. I was interested in 1) automatic HDD spin down as well as 2) automatic shut down (-> suspend, ACPI S3) after some idle time.
    Topic 1) was for one out of my 3 different Toshiba HDDs not running out of the box, i.e. the related OMV setting in 'Storage -> Physical Disks' was not able to spin down this disk (the used command 'hdparm' is not working). I found then several information in:
    HDD Spindown Probleme (GER)
    which refers to:
    Festplatten in den Standby-Modus versetzen unter Ubuntu Desktop/Server mit hd-idle (GER)
    which refers to:
    hd-idle on (ENG)
    Out of all these information I wrote these 'how to' steps:

    *** Install 'hd-idle' in OMV (login as 'root' user) ***
    ** 0) install additional 'build / make' files **
    apt-get install debhelper
    apt-get install fakeroot
    apt-get install build-essential

    ** 1) make a download directory **
    mkdir hd-hidle_download
    ** 1.1) enter the directory **
    cd hd-hidle_download

    ** 2) download the 'hd-idle' source package file **
    ** 2.1) extract the package **
    tar xvfz hd-idle*.tgz

    ** 3) enter the extracted 'hd-idle' folder, it is one directory down **
    cd hd-idle

    ** 4) make the '*.deb' file **
    dpkg-buildpackage -rfakeroot
    ** 4.1) goto the made *.deb file, it is one directory up **
    cd ..

    ** 5) install the '*.deb' file **
    dpkg -i hd-idle_*.deb

    *** 'hd-idle' setup ***
    ** a) disable all spin-down and power management settings in OMV ***
    'Storage -> Physical Disks'

    ** b) open the 'hd-idle' configuration file via the 'nano' editor **
    nano /etc/default/hd-idle
    ** b.1) insert for each HDD (accessed via their UUIDs) a spin-down command '-a /dev/<...> -i 600', e.g. spin-down of 3 HDDs after approx. 600 seconds **
    HD_IDLE_OPTS="-i 0 -a /dev/disk/by-uuid/bacb10a1-6dc5-48b9-a6f4-ed836b7dfa4a -i 600 -a /dev/disk/by-uuid/481b459f-aad7-468e-b0fe-9401c94eb4fc -i 610 -a /dev/disk/by-uuid/3b5e7398-d517-4477-a3b9-aa46c4347184 -i 620"
    * hint: Parameter '-i 0' at the beginning avoids spin-down of not explicitly specified HDDs. *
    ** b.2) allow hd-idle to start **
    ** b.3) save the file and close 'nano' **

    ** c) via OMV auto-start the 'hd-idle' service (daemon) **
    'System -> Scheduled Jobs'
    * hint: use options 'reboot', user 'root' and command 'service hd-idle start' *

    ** d) do also this if the OMV plug in 'Autoshutdown' is in use **
    ** PROBLEM!!! The required 'systemd' service manager is not in use on Debian 7 / OMV 2.x! **

    ** e) reboot OMV, now it should work **

    ** f) Check that 'hd-idle' is running via OMV
    'Diagnostics -> System Information -> Process List'
    ** in column 'Command' should be somewhere such an entry: **
    usr/bin/hd-idle -i 0 -a /dev/<...> -i 620

    Now I stuck with step d) because I'm not really familiar with Linux. The missing task is: How to restart the 'hd-idle' daemon after wakeup from suspend with the OMV 2.x used 'SysVinit'?
    Hint: Without d) the 'hd-idle' service is still running but no longer functional, i.e. no further HDD spin down happens.
    Could somebody help me, please?

    Thank you!


    Addendum 1
    After some further tests it seems it has nothing directly to do with the suspend and wake-up:
    hd-idle obviously works in the following way: It reads in some interval from each HDD (or wherever these data are located) its performed reads and writes. If both counter values have not been changed in the defined spin down time (-i parameter) then a spin down will be triggered.
    If the HDDs have been simply restartet due to e.g. a wake-up after a suspend then these counters still deliver the same values as at the time as hd-idle last send them to spin down state. This means 1. hd-idle is NOT aware that the HDDs are no longer in spin down state and 2. a further spin down trigger will never happen due to the not changed counters.
    A workaround would be the above mentioned hd-idle daemon restart after wake-up ... (a read access would also release this blocking state but this is usually no way for the parity HDD in a SnapRAID system).

    Edited 6 times, last by _Michael_: Link to the new OMV 5.x thread inserted. ().

  • my solution (I don't know if such a file change is a good idea but at least it works):

    ** d) do also this if the OMV plug in 'Autoshutdown' is in use **
    change the file '/etc/pm/sleep.d/autoshutdown-restart' as visible below:

  • hi,

    im having the same problem, only that im using a raspberry pi 3 witz raspbian (jessie). my hdd is an 4 gb wd my book (i think they put greens in it).

    using hdparm hdparm -y works and puts the drive into sleep, hdparm -s xx seems to write something to the drice, at least it sounds like it. after waiting the countdown finished, nothing happens.

    using hd-idle works but the drive starts spinning again after a short while although im pretty sure nothing is reading or writing on the drive, since the hdd stays in standby using hdparm -y.

    if i on the other hand use hd-idle and acces my hdd after spindown the counter seems to work again and hd-idle puts it to sleep after finishing its count down.

    im not sure if it is from any interest but a recognized something else:
    my my book has a led light showing its status: light on means drive is idle, fast blinking means working and slow blinking means standby.
    using hdparm -y the driv shows slow blinking as its supposed to but using hd-idle the led stays on

    im not sure if understand your script. is it stopping and starting hd-idle over and over again so it would recognize the hdd spinning after it woke up and after hd-idle puts it into standby?

    i also saw a solution using a script running hdparm -y avery 30 minutes or so. i tried hdparm -y while copying a file on the hdd and the file was still copying but i could hear my drive when i used hdparm -y. im not sure what it does exactly but i fear it might damage the drive over time.
    this sound was actually similar to the one when using hdparm -s xx

    when the drive starts spinning again after hd-idle pu it to sleep i cant unmount it via terminal using sudo umount /dev/sda1:

    pi@raspberrypi:~ $ sudo umount /dev/sda1
    umount: /media/pi/66926CEA926CBFE3: target is busy
    (In some cases useful info about processes that
    use the device is found by lsof(8) or fuser(1).)
    pi@raspberrypi:~ $ umount: /media/pi/66926CEA926CBFE3: target is busy
    -bash: umount:: Kommando nicht gefunden.
    pi@raspberrypi:~ $ (In some cases useful info about processes that
    > use the device is found by lsof(8) or fuser(1).)^C
    pi@raspberrypi:~ $

    update 2:
    sudo smartctl -d sat -a /dev/sda shows my load cycle count which increases after i ran hdparm -s xx and waited für xx seconds
    i guess it does just half the job its supposed to

  • ...
    im not sure if understand your script. is it stopping and starting hd-idle over and over again so it would recognize the hdd spinning after it woke up and after hd-idle puts it into standby?

    Sorry but I'm sure you have not really understood my problem and my solution for it ... (you have to read my two posts entirely).
    The script 'autoshutdown-restart' (it is from the plugin 'Autoshutdown') does stop the hd-idle daemon at a PC suspend event and starts it (again) at a PC wake-up (resume) event. Because of the new started daemon the current = not changed HDD read / write counters are 'valid' hd-idle start-counter values and a further HDD spin down will be triggered after the timeout period.

  • Hello Michael

    first thank you for the description about HD-Idle (install and configuration). I just want to give my input about HD-idle and Hdparm with 2 HD USB3 from Lacie Porsche design 8TB.
    I have a Odroid XU4 with Openmediavault (ARMBIAN 5.33 user-built Debian GNU/Linux 8 (jessie) 4.9.47-odroidxu4). I have 2 DD external USB3 drive (Lacie Porsche design 8TB).

    I have several problems to put these drives down automatically, I mean in standby mode.

    About HDparm:
    I tried HDparm (from GUI and CLI), don't work correctly. Sometimes, in CLI the option -C return that the drive is in standby mode, and when I check the drive, it's still spin up.
    In CLI when I send HDparm -y to put directly the disk in standby it's works (in standby mode the led on the USB box are always on but the disk don't spin).

    About ID-Idle
    I followed the instruction below, controlled process, looks fine. After reboot, the both drives go down (in standby mode the LED on the USB box blinking slowly and disk don't spin, ideal mode for me) after the period that I gave. When I try to access, the drives spin up, that's ok, but after never goes down. I tried to restart the service of HD-Idle (CLI) and it's works only one time, after the both drives staying up, never go in standby mode, even if I restart the process hd-idle. The only way it's to reboot the Odroid and again it's works only one time. Very strange.
    Somebody are more experience with HD-Idle on Odroid ?

    Currently I'm testing the command :

    smartctl --set standby,120 /dev/sda

    For the moment,it's look work correctly (in standby mode the LED on the USB box are always on, but the disk don't spin)...



  • external USB3 drive

    Spindown problems expected depending on USB-to-SATA bridge used and firmware version of the chip. If your drives react correctly to 'hdparm -y' or '-Y' but not '-S' searching for one of the available scripts to deal with crappy USB disk enclosures might do the job.

    Curious: How does lsusb output looks like?

  • Hello,

    here the result of lsusb -v


  • here the result of lsusb

    Thank you. Branded firmware (0x059f:0x106f) so no luck (LaCie doesn't develop internal hardware, it would need a teardown of the enclosure to get an idea which controller is inside... but since you won't be able to reflash its firmware it's of not that much use and might lead to warranty becoming void)

  • Hello thank you.

    Finally I find a way that works with these both external USB disk with spindown time managed from the GUI.

    1. I installed the last version of OMV odroid_xu4_OMV_image then migrate on eMMC (sata install.. )
    2. Without USB DISK connected, in the GUI, SMART tab, I set the power mode to "Standby" and save.
    These both external hard-drive doesn't support SMART management with OMV. If a click on the SMART tab when the disks are mounted, I always have a notification communication error windows, and I must restart the system. I don’t understand why I have this error because under SMART tab, the general settings isn't enable.
    3. Shutdown, plug the both USB3 disks. Note:I tried also to use only one Odroid USB3 port with a USB3 hub, but that don't work, only one Disk is detected.
    4. Start the system and mount the both disks. Under Disk management, set the spin down time to 5 min and ..... It's work.

    In my old config, I don't know why SMART was activated. I never activated this feature in the gui. But If I check the log the service was activated.

    I checked the smartd.conf and one line was activated. I tried to comment this line and restarted the system, but then, it was impossible to log to the GUI !!! So, I decided to do a new install.

    Now, with a clear config, if I check the syslog, I don't find any smartd entry and spindown time work correctly and the disks stay in stanby mode.


  • Hi malcom, it works :) ! There is a general "but": 'My Autoshutdwon' workaround is no longer working, see my post #2. I tried also this:

    i.e. I used now 'systemctl' but also w/o success. Any idea? (I also tried systemctl restart hd-idle.service at row 14.)



  • On my wall I have a comment from @sm0ke

    "Do you use…le-restart-resume.service (i just did and will know in an hour if resuming works correct) or…ment/hd-idle_resume.patch?"

    I do not use autoshutdown so I did not have a look at it. Maybe it is helpful for you.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!