James Phillips anti_spam256 at yahoo.ca
Sat Nov 14 03:50:25 UTC 2009

I was going to just respond to myself again, but I see I generated some discussion :)

Anyway, In the 

page at least two people mentioned the ATAidle utility. It is not recommended for the same reason APM isn't: devices sleep without OS consent.

Anyway, I now know the drive saves 5W spun down because this command has immediate effect:
# ataidle -o /dev/ad4
Followed shortly by:
Nov 13 16:51:11 dusty kernel: ad4: TIMEOUT-WRITE=DMA retrying (1 retry left) LBA=23261855

I settled on (But using the rc.conf format):
ataidle -I 6 -S 10 /dev/ad4
because I think the "Idle timer" (minutes) and "Supsend timer" (minutes) stack to 16 minutes. Setting the suspend time has an effect of immediately spinning down the disk though (mentioned in the man page)

No logging means I have to figure out how often the drive spins up/down using other means. (I don't think the wake from idle (disk seems to keep spinning) or suspend triggers a message.)

Chuck wrote:
":You might also want to note that 2.5" laptop drives are/should be  explicitly designed to spin down and park themselves much more often than generic IDE drives are; some generic desktop drives will fail quite rapidly (ie, in a matter of months) if you attempt to spin them down many times a day.:"

I suspect they are rated for a set number of power-on cycles. If (say) 5 shutdowns/day kills the drive in months, it must be rated for something like 1000. (hmm, I should look it up.)

Ideally, I want 1-5 shutdowns a day, depending on use. I know for a fact I want the drives shutdown when the server is "idling" for hours at a time. When set for a 15 minute time out (with atacontrol), the drive was not getting spurious shut-downs.

--- On Fri, 11/13/09, David Allen <the.real.david.allen at gmail.com> wrote:

> > % grep diskless /etc/rc
> > dlv=`/sbin/sysctl -n vfs.nfs.diskless_valid 2>
> /dev/null`
> > if [ ${dlv:=0} -ne 0 -o -f /etc/diskless ]; then
> >     sh /etc/rc.initdiskless
> > # Run these after determining whether we are booting
> diskless in order
> > # to minimize the number of files that are needed on a
> diskless system,
> The answer finally appears!
> A note to the OP.  The only way I've found to keep a
> disk spun down
> under FreeBSD is using memory devices for both /var and
> /tmp.
> Disabling syslogd isn't enough, nor is modifying
> /etc/crontab, root's
> crontab (or even disabling cron) to limit disk
> access.  But to use
> memory devices and have a "normal" system, you'll need to
> re-populate
> both /var and /tmp at startup.   Which, it
> turns out, means starting
> with /etc/diskless.

I think I thought of that (putting /var/log in RAM) on my own: it does not really fit what my server does though: it is a file server.

I have about 5-6GB set aside (big enough to hold a DVD image) for /var and /tmp, and only 256MB of memory. Backing the ramdisk with swap defeats the purpose.

Chuck wrote:
"rsync -a /var_template /var"
That is only half the battle: you need a way to flush it to disk when it actually spins up; else risk loosing log data (In the event of power/hardware failure).

I suppose a cron job backing up periodic filesytem snapshots is possible, but you would have to trigger on the number of interrupts seen by the disk or something to avoid waking it. I was thinking /proc/interrupts , but that is a Linux feature :P

Do the messages from spinning the disk back up (with atacontrol) have any hooks? I suppose if you are desperate, you can (tail+) grep /var/log/messages. 

> Someone should add a section named  "Non-Diskless
> Diskless Operation"
> to the Handbook.

I like to think what I am doing (with 10 year old hardware) is "cutting edge research." That is to say, the normal mode of operation for servers is to hold your nose and let them run 24/7. It is more reliable that way.

The current trend for mitigating that waste of energy is consolidation. If you can put a dozen servers in one box, hopefully only 1 or 2 will be active at once.

However, I think drivers and hardware (like NICs with WOL) may have matured to the point that it is possible to run "non-critical" servers (and desktops) in such a way that they only turn on when needed. Suspend mode for the newer desktops here draw only ~3watts: comparable to the power-off (soft-off) state.

> Thanks again for all the help!

Make your browsing faster, safer, and easier with the new Internet Explorer® 8. Optimized for Yahoo! Get it Now for Free! at http://downloads.yahoo.com/ca/internetexplorer/

More information about the freebsd-questions mailing list