Spinning down a hard disk after boot

Help with using MiniMyth (except Booting)

Moderator: Pablo

Post Reply
WittFan
Member
Posts: 11
Joined: Tue Jan 06, 2009 10:51 pm

Spinning down a hard disk after boot

Post by WittFan » Fri Oct 12, 2012 1:05 am

I'm looking for a way to spin down my hard disk after booting Minimyth. Issuing an hdparm -y from the command line works, but how do I script this?

JoeHenley
Contributor
Posts: 185
Joined: Sun Aug 06, 2006 4:12 pm

Re: Spinning down a hard disk after boot

Post by JoeHenley » Fri Oct 12, 2012 3:41 pm

Hi,

Below is a code "chunk" which I have in my minimyth.pm file to modify how lm_sensors runs. You can modify it to your needs and put it in your minimyth.pm file. Don't forget to modify minimyth.conf to cause minimyth.pm to run (MM_MINIMYTH_FETCH_MINIMYTH_PM='yes').

---- snip ------------------------------------------------------
# Set up new lm_sensor info
$minimyth->confro_get('sensors3.conf', '/etc/sensors3.conf');
chmod(0755, '/etc/sensors3.conf');
system(qq(/sbin/modprobe it87 > /dev/null 2>&1));
system(qq(/usr/bin/sensors -s > /dev/null 2>&1));
---- snip ---------------------------------------------------

You could probably get away with only:
# Set up for hard drive spin down
system(qq(/sbin/hdparm -y > /dev/null 2>&1));

Make sure you have hdparm in /sbin directory.

Good luck and let us know how it works.

Joe Henley

WittFan
Member
Posts: 11
Joined: Tue Jan 06, 2009 10:51 pm

Re: Spinning down a hard disk after boot

Post by WittFan » Sat Oct 13, 2012 12:39 am

Thanks for the reply Joe. Your suggestion started me in the right direction. Adding the line below to my minimyth.pm caused the disk to spin down, but then it spun back up almost immediately. :(

Code: Select all

    # Spin down hard disk
    system(qq(/usr/sbin/hdparm -Y /dev/disk/by-kernel/sda > /dev/null 2>&1 ));
But by adding a sleep command at the beginning of the line and an ampersand at the end of the line (to allow the rest of the boot process to continue while hdparm sleeps,) the disk spins down toward the end of the boot process and stays spun down. 8)

Code: Select all

    # Spin down hard disk
    system(qq(/bin/sleep 30 && /usr/sbin/hdparm -Y /dev/disk/by-kernel/sda > /dev/null 2>&1 &));
Thanks for the help!

Post Reply