Results 1 to 5 of 5

Thread: Making "hdparm -S" a cron job? and other energy-efficiency issues

  1. #1
    Join Date
    Jul 2007
    Beans
    284
    Distro
    Ubuntu

    Making "hdparm -S" a cron job? and other energy-efficiency issues

    I'm looking for ways to save some energy on my little home server, and read something about using hdparm -S to spindown the disks after a certain amount of time. I also read that you could make it a cron job somehow. Looking into cron, however, I found that everything was set up to be run on a fixed-time basis; i.e. once an hour, once a day, etc. What I would like is for hdparm to spin down the drives when the machine has been idle for, say, 10 minutes. How exactly would I go about this?

    Also, I'm a little bit skeptical about how spinning down the harddisks would save that much energy anyway. In the case of this computer, it just has one IDE drive in it. Should I even bother with this in the first place? I guess I don't have a good idea of how much energy the computer takes in in the first place but if I'm going to have it running all the time I'd like to minimize the power consumption when it's idle (not to mention the heat output as well). Any ideas?

    Thanks,
    Dan

  2. #2
    Join Date
    Sep 2006
    Beans
    1,610
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: Making "hdparm -S" a cron job? and other energy-efficiency issues

    Code:
    sudo hdparm -S120 /dev/sda
    Will set the first disk to spin down after 10 minutes of idle time.

    No need to put it in cron, just add it to the /etc/rc2.d/S99rc.local script. It's good until you reboot.

  3. #3
    Join Date
    Jul 2007
    Beans
    284
    Distro
    Ubuntu

    Re: Making "hdparm -S" a cron job? and other energy-efficiency issues

    Thanks, that's a good start, but how do I make it permanent? I may or may not be powering down this machine from time to time, and I'm sure I'll forget how to set this up after a certain amount of time, so it'd be great if it was a permanent operation.

    -Dan

  4. #4
    Join Date
    Nov 2004
    Location
    Seattle, WA
    Beans
    93
    Distro
    Xubuntu 9.10 Karmic Koala

    Re: Making "hdparm -S" a cron job? and other energy-efficiency issues

    I think you can just add that line to /etc/rc.local and make sure that script is marked executable.

    You might be able to reduce your disk spinning even more by mounting /tmp as a tmpfs. This is only worthwhile if you have enough RAM to store all of /tmp without swapping.

    Take a look at:
    http://en.wikipedia.org/wiki/TMPFS#Linux
    http://forums.debian.net/viewtopic.php?t=16450

  5. #5
    Join Date
    Jul 2007
    Beans
    284
    Distro
    Ubuntu

    Re: Making "hdparm -S" a cron job? and other energy-efficiency issues

    So, for example, I would just need to add:
    Code:
    #!/bin/sh -e
    sudo hdparm -S120 /dev/sda
    to the /etc/rc.local file? Or is there more to it? I'm still not exactly an expert at writing these little Unix scripts.

    -Dan

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •