Bananian

Spin down external usb hard disk

10 8419
Haxy  
I have samba and deluge on my bananaPi. The problem is that my external usb hard disk still spin down 24/7
How to fix that?
MrK1982  
On my previous raspi i decided to spin down my hard drives after 10 minutes of inactivity. I wrote a little tutorial to help me remember the needed steps. I haven't testet this tutorial on a banana pi yet, but I don't see a reason why it shouldn't work. Perhaps it works for your needs.

We need to compile hd-idle cause there is no functional package for the processor architecture.
1st step:

  1. apt-get install cvs debhelper
Copy the Code
This installs the cvs and debhelper package. CVS is needed for downloading the source package. debhelper contains tools for building your own '.deb' packages which could be installed by 'dpkg -i'.

2nd step:

  1. mkdir /opt/hd-idle
  2. cd /opt/hd-idle
  3. cvs -d:pserver:anonymous@hd-idle.cvs.sourceforge.net:/cvsroot/hd-idle login
Copy the Code
First we create a directory where we want to work with the hd-idle source code. Than we 'cd' into this. The following 'cvs command  is a login only. Press 'Enter' if you are asked for a password. After that we download the source package:

  1. cvs -z3 -d:pserver:anonymous@hd-idle.cvs.sourceforge.net:/cvsroot/hd-idle co -P hd-idle
Copy the Code
3rd step:
Change to the new directory hd-idle (full path is now /opt/hd-idle/hd-idle) and then build the new hd-idle package:

  1. cd hd-idle
  2. dpkg-buildpackage -rfakeroot
  3. cd ..
Copy the Code
Now you see why we created the first hd-idle directory. The resulting package 'hd-idle*.deb is stored there.

4th step:
Install the new package hd-idle*.deb:

  1. dpkg -i hd-idle*.deb
  2. service hd-idle start
  3. update-rc.d hd-idle defaults
Copy the Code
Restarting the hd-idle service after install and  adding it to rc.d for automatic startup.

5th step:
Configure hd-idle for your own needs:

  1. nano -w /etc/defaults/hd-idle
Copy the Code
For an automatic startup we need to change the first line of that file:

  1. START_HD_IDLE=true
Copy the Code
Then we configure the hd-idle options:

  1. HD_IDLE_OPTS="-i 0 -a /dev/disk/by-uuid/*Enter your UUID* -i 600"
Copy the Code
The uuid of your device could be read out by command 'blkid'. Disk access based on the device name only like '/dev/sda' for example is not recommended. A change of the device name is a common problem notably on usb devices. The uuid of a drive could only be changed on a fdisk operation or by a user intervention (not recommended).

Hopefully this little tutorial fits your needs. If not, leave me a quote I will try this by myself after I solved my sata problems.

Haxy  
It is too hard for me, I don't want to break something.
I will try hdparm with -s parametr.

MrK1982  
Hi Haxy,

the problem is, as far as I know, hdparm does not support usb drives.

mattrix  
hdparm works fine for me with 2x external USB hard-drives:

apt-get install hdparm

Then in a bootup bash script

hdparm -S180 /dev/disk/by-uuid/01CF0AC9AA5EAF70
hdparm -S180 /dev/disk/by-uuid/DCF412E2F412BEA8

MrK1982  
Perfect ... had a few problems with running hdparm for usb drives on my old dockstar ... but this is few years ago ... Nice to know that its functional now ...

Haxy  
hdparm works fine for me with 2x external USB hard-drives:

apt-get install hdparm

Then in a bootup ...
mattrix Posted at 2014-8-29 03:46


Where is this bootup script?

Put it in
  1. /etc/rc.local
Copy the Code

T.S.  
hdparm does not work on all my sata disks. Test result:
160GB WD Scorpio Black -> OK.
1TB Toshiba -> NOK, does not spin down.

Edited by woodyxxl at Sun Oct 26, 2014 03:28

Thx for post #2

looks like
nano -w /etc/defaults/hd-idle
should be
nano -w /etc/default/hd-idle

1st test: looks like hd-idle is not running -> service hd-idle start brings no starting message

2nd test: confirm - no start... (top or htop -> not running - same killall hd-idle -v -> no process running)

V1.04 & V1.05 -> not running

Check with Raspberry Pi -> V1.05 -> OK

Difference Raspberry Pi vs Banana Pi ->
dpkg-buildpackage: Warnung: debian/rules ist nicht ausführbar: wird korrigiert


You have to log in before you can reply Login | Sign Up

Points Rules