[RESOLVED] auto turn off hard drive

This forum is for Marvell Kirkwood devices such as the GoFlex Home/Net, PogoPlug v1/v2, SheevaPlug, and ZyXEL devices.

[RESOLVED] auto turn off hard drive

Postby kzee » Thu Dec 22, 2011 6:39 am

hi,
i have a goflex home. archlinux is woking great so far :D
just wondering is there a way to turn off the hard drive automatically after a period of inactivity ? or put it in sleep mode?
thanks
kzee
 
Posts: 5
Joined: Thu Dec 22, 2011 6:33 am

Re: auto turn off hard drive

Postby hydro » Thu Dec 22, 2011 10:36 am

I'm not too familiar with SATA drives, but I think hdparm can handle them as well. You can set the standby timeout (10 minutes in this example, see man page)
$this->bbcode_second_pass_code('', '
hdparm -S 120 /dev/sda
')
or force standby immediately
$this->bbcode_second_pass_code('', '
hdparm -y /dev/sda
')
However, if your operating system is on your hard drive, you may have to set some other options to avoid spinning up again too soon, if a process wants to write to disk. If hdparm doesn't work, try sdparm or sg_start (package: sg3_utils). The latter is also required by spindown (in AUR).
VDR on DockStar / Pogoplug E02: http://linux.bplaced.net/
hydro
 
Posts: 210
Joined: Wed Jun 15, 2011 2:03 pm
Location: Germany

Re: auto turn off hard drive

Postby kzee » Fri Dec 23, 2011 8:18 am

thanks hydro.
i tried the hdparm and it worked
however, like you said it spins up after 10mins or so.
how do i know which process(es) are writing to the disk ?

thanks
kzee
 
Posts: 5
Joined: Thu Dec 22, 2011 6:33 am

Re: auto turn off hard drive

Postby hydro » Fri Dec 23, 2011 3:15 pm

Well, fuser and lsof may help, e.g.
$this->bbcode_second_pass_code('', '
lsof +D /
')
displays processes that have open files in the root mount path. You can try to remove some unneeded daemons from /etc/rc.conf, but this probably won't help much. Here are some more hints. Mounting some directories on an USB flash drive (for files that are primarily read, e.g. /usr) or in RAM (for files that are often written, e.g. /var/log) may be an option.
VDR on DockStar / Pogoplug E02: http://linux.bplaced.net/
hydro
 
Posts: 210
Joined: Wed Jun 15, 2011 2:03 pm
Location: Germany

Re: auto turn off hard drive

Postby kzee » Sat Dec 24, 2011 2:03 am

i followed the link u posted
https://wiki.archlinux.org/index.php/La ... ools#Disks
and installed laptop-mode-tools
it is working perfectly now :D

thanks for pointing me to the right direction :mrgreen:
kzee
 
Posts: 5
Joined: Thu Dec 22, 2011 6:33 am

Re: auto turn off hard drive

Postby ldi9999 » Thu Mar 22, 2012 5:37 pm

$this->bbcode_second_pass_quote('kzee', 'i') followed the link u posted
https://wiki.archlinux.org/index.php/La ... ools#Disks
and installed laptop-mode-tools
it is working perfectly now :D

thanks for pointing me to the right direction :mrgreen:


Can you provide more details on your setup? Step by Step instructions would be highly appreciated.
Thanks!
ldi9999
 
Posts: 59
Joined: Mon Mar 05, 2012 10:31 pm

Re: [RESOLVED] auto turn off hard drive

Postby moonman » Thu Mar 22, 2012 6:40 pm

This is what I have in my cron (run "crontab -e")
$this->bbcode_second_pass_code('', '*/15 * * * * ID=DriveIdle /usr/bin/sdparm -C stop `mount | grep <partition label> | cut -c1-9`')

<partition label> is the name of one of the partitions on the hard drive, does not matter which one if there are many. It basically extracts the path (/dev/sdx) from the mount command because every time you boot the path can change to sda sdb sdc depending on how many hdds you have plugged in.
Pogoplug V4 | GoFlex Home | Raspberry Pi 4 4GB | CuBox-i4 Pro | ClearFog | BeagleBone Black | Odroid U2 | Odroid C1 | Odroid XU4
-----------------------------------------------------------------------------------------------------------------------
[armv5] Updated U-Boot | [armv5] NAND Rescue System
moonman
Developer
 
Posts: 3387
Joined: Sat Jan 15, 2011 3:36 am

Re: [RESOLVED] auto turn off hard drive

Postby moonman » Thu Mar 22, 2012 6:41 pm

You would also need to install sdparm with pacman -Sy sdparm
Pogoplug V4 | GoFlex Home | Raspberry Pi 4 4GB | CuBox-i4 Pro | ClearFog | BeagleBone Black | Odroid U2 | Odroid C1 | Odroid XU4
-----------------------------------------------------------------------------------------------------------------------
[armv5] Updated U-Boot | [armv5] NAND Rescue System
moonman
Developer
 
Posts: 3387
Joined: Sat Jan 15, 2011 3:36 am

Re: [RESOLVED] auto turn off hard drive

Postby ldi9999 » Thu Mar 22, 2012 6:53 pm

Thanks for the info. So what does this configuration do? Put hard drive in idle for how long,when to wake up, etc..? Please explain. Thanks again!
ldi9999
 
Posts: 59
Joined: Mon Mar 05, 2012 10:31 pm

Re: [RESOLVED] auto turn off hard drive

Postby moonman » Thu Mar 22, 2012 7:04 pm

cron will execute the command I rpovided every 15 minutes so the hdd will spin down. It will spin up when you want to access it automatically.
Pogoplug V4 | GoFlex Home | Raspberry Pi 4 4GB | CuBox-i4 Pro | ClearFog | BeagleBone Black | Odroid U2 | Odroid C1 | Odroid XU4
-----------------------------------------------------------------------------------------------------------------------
[armv5] Updated U-Boot | [armv5] NAND Rescue System
moonman
Developer
 
Posts: 3387
Joined: Sat Jan 15, 2011 3:36 am

Next

Return to Marvell Kirkwood

Who is online

Users browsing this forum: No registered users and 36 guests