Spinning down a hard disk after boot
Moderator: Pablo
Spinning down a hard disk after boot
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?
Re: Spinning down a hard disk after boot
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
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
Re: Spinning down a hard disk after boot
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.
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.
Thanks for the help!

Code: Select all
# Spin down hard disk
system(qq(/usr/sbin/hdparm -Y /dev/disk/by-kernel/sda > /dev/null 2>&1 ));

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 &));