Welcome! Log In Create A New Profile

Advanced

Debian - Hard Drive Idle Tool

Posted by stormlight 
Debian - Hard Drive Idle Tool
December 20, 2015 01:10AM
Is there an hard idle tool? Archlinux has hd-idle package. OpenWRT has sd-idle. Is there one for Debian Arm? I performed 'apt-cache search idle' but do not any proper package. Online search has limited results.
Re: Debian - Hard Drive Idle Tool
December 20, 2015 01:32PM
stormlight,

I'm not aware of any Debian package for this purpose (I never look for it, there migh be one). But here is a simple script I run in /etc/rc.local to set spindown period for a specific drive.

If you have more than one drives, clone the code for each mountpoint. The mountpoint here is /media/HOME

cat spindown
#!/bin/sh  
#
#

logger "Set spindown period for all SATA HDD media drives"

if /bin/mountpoint /media/HOME -q ; then
   DEV=`mount | grep 'HOME ' | cut -c1-8`
   hdparm -S 240 $DEV
   logger -s -i "Set Spin down period to 20 minutes for HOME on " $DEV  
fi

exit 0

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)



Edited 1 time(s). Last edit at 12/20/2015 01:33PM by bodhi.
Re: Debian - Hard Drive Idle Tool
January 03, 2016 11:49PM
Thank you Bhodi!

So I learned how to compile hd-idle from source. :-) Noob in action. I attached the pre-compile for Oxnas. I have not tested on Kirkwood.

cp hd-idle_1.05_armel.deb /tmp
cd /tmp

#install package
dpkg -i hd-idle_1.05_armel.deb

#enable/edit service configuration 
nano /etc/default/hd-idle
	change: START_HD_IDLE=false  To: START_HD_IDLE=True
	change: #HD_IDLE_OPTS="-i 180 -l /var/log/hd-idle.log"
	To: 	HD_IDLE_OPTS="-i 900 -l /tmp/hd-idle.log"                   #set 15min to sleep
#save and exit

/etc/init.d/hd-idle start

hd-idle_1.05_armel.deb md5: 3d2cd47463b1e41765d650d778cbd80d
source: http://sourceforge.net/projects/hd-idle/files/hd-idle-1.05.tgz/download
author website: http://hd-idle.sourceforge.net/



Edited 2 time(s). Last edit at 01/04/2016 05:22PM by stormlight.
Attachments:
open | download - hd-idle_1.05_armel.deb (14.4 KB)
open | download - source-hd-idle-1.05.tgz (17.5 KB)
Re: Debian - Hard Drive Idle Tool
January 04, 2016 01:41AM
Cool!

What we usually do with deb binary like this is:

- include a link to the source dode
- run a md5checksum.

Pls update your post with the info above so I can include this tool in the sticky tips thread.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Debian - Hard Drive Idle Tool
January 12, 2016 10:50AM
just as an alternative to this - i use hdparm from the repos.

apt-get install hdparm

https://en.wikipedia.org/wiki/Hdparm
Re: Debian - Hard Drive Idle Tool
January 14, 2016 05:36PM
Gravelrash,
The nice thing about hd-idle is that even if someone is login and in the directory of the harddrive (idle) or in the folder explorer, the hard drive can still go to sleep. HDparm will not put the drive to sleep if there is active session and no activity.
Re: Debian - Hard Drive Idle Tool
January 14, 2016 11:54PM
stormlight Wrote:
-------------------------------------------------------
> Gravelrash,
> The nice thing about hd-idle is that even if
> someone is login and in the directory of the
> harddrive (idle) or in the folder explorer, the
> hard drive can still go to sleep. HDparm will not
> put the drive to sleep if there is active session
> and no activity.

No, hdparm will put the drive to sleep just fine when there is active session (as long as the active session does not periodically write to the disk).

hdparm is very reliable in all aspects. As I mentioned above, you can put the script in /ect/rc.local and basically forget it is even there.
http://forum.doozan.com/read.php?2,24943,24944#msg-24944

To monitor disk activity to find the reason why a disk did not remain in the sleep state:
iotop -o -b -qqq

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)



Edited 1 time(s). Last edit at 01/15/2016 03:24AM by bodhi.
Re: Debian - Hard Drive Idle Tool
June 05, 2016 02:16PM
Gravelrash Wrote:
-------------------------------------------------------
> just as an alternative to this - i use hdparm from
> the repos.
>
> apt-get install hdparm
>
> https://en.wikipedia.org/wiki/Hdparm

This is excellent, I can't wait to get HD auto mounting to use it. I've installed it and tested some of its features already, r/w speed, it's great and simple to use.
Thanks!
Re: Debian - Hard Drive Idle Tool
December 09, 2018 06:54AM
hd-idle pre-compiled for NAS326

First of all BIG thanks to bodhi and thanks to stormlight.

cp hd-idle_1.06_armhf.deb /tmp
cd /tmp

install package
dpkg -i hd-idle_1.06_armhf.deb

enable/edit service configuration
nano /etc/default/hd-idle

Quote

change: START_HD_IDLE=false To: START_HD_IDLE=True
change: #HD_IDLE_OPTS="-i 180 -l /var/log/hd-idle.log"
To: HD_IDLE_OPTS="-i 900 -l /tmp/hd-idle.log" #set 15min to sleep

save and exit

start hd-idle
/etc/init.d/hd-idle start


hd-idle_1.06_armhf.deb --- md5: 1118b86987407d57b0311204c667c1b8

source: https://sourceforge.net/projects/hd-idle/files/
author website: http://hd-idle.sourceforge.net/



Edited 2 time(s). Last edit at 12/09/2018 06:58AM by Hardy.
Attachments:
open | download - hd-idle_1.06_armhf.deb (13.9 KB)
Re: Debian - Hard Drive Idle Tool
December 09, 2018 07:15AM
For a Western Digital HDD, there is a idle3-tools. I wonder if this tool will work with other brand, i.e. a Seagate HDD.
Re: Debian - Hard Drive Idle Tool
October 05, 2021 01:42PM
Hi,

Bodhi, your suggested scrip didn't seem to work for me, but I found a solution.

My setup
NSA325 running Debian
2 harddisks: /dev/sda and /dev/sdb. Configured as raid0 with mdadm, which gives me /dev/md0 as the combined drive and mounted at /media/nas

Script
The hdparm command from your script worked, but I seem to have trouble using that on /dev/md0. On /dev/sda or /dev/sdb it worked perfectly from the command line. Changing your script to mention either /dev/md0 or /dev/sda and /dev/sdb didn't seem to work.

Solution
I searched and found this: https://forums.debian.net//viewtopic.php?f=5&t=70496

/etc/hdparm.conf can carry idle timeouts:


/dev/sda {
spindown_time = 240
}

/dev/sdb {
spindown_time = 240
}
Re: Debian - Hard Drive Idle Tool
October 05, 2021 03:50PM
Thanks Bobby,

Using the conf file is great for a fixed system. Script is a bit more flexible, but we'll take whichever works!

In this case, the RAID configuration is masking the real devices, I think the script could work with a bit more adjustment.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)



Edited 1 time(s). Last edit at 10/05/2021 03:52PM by bodhi.
Author:

Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: