Subject: Re: Sleeping an LC III
To: Ken Hughes <hughes@interchange.ubc.ca>
From: Don Yuniskis <auryn@gci-net.com>
List: port-mac68k
Date: 12/21/2001 11:59:49
Greetings!

>Did Mr. Benson get an answer to his question?
>Perhaps I missed it but I was sort of watching.
>
>I have a similar query ...
>I wonder what I would have to configure if say
>I wanted to actually put a little toggle switch on the
>hot lead to the SCSI drive's power supply, and actually
>turn the drive(s) off when they are particularly idle.
>
>How about if I had lots of RAM and wanted to run apache
>and just deliver 3 or 4 pages (under 2 megs of HTML)
>i.e., no disk access and just deliver from RAM?
>
>Could a regular non-wizard guy like me figure out how to do this?
>
>Thanks for your interest, or any thoughts you may have.

Depends on what file systems the drive has on it.
If you can ensure that *nothing* on (any of) those
file systems will be accessed while the drive is
off -- or, if it is acceptable for accessing them to
fail, then you *might* be able to do this.

[note you can't have a swap partition on that spindle
either!]

You can possibly allow *some* of the things on that
drive to be accessed in the absence of the physical medium
if you build a memory file system (you said lots of RAM!),
copied the files (and any required shared libraries)
onto that file system and mounted/symlinked accordingly.

As for the drive itself, you could then sync and umount those
filesystems (which won't work unless there are *no* open 
files on any of the filesystems).  Then, issue a START/STOP 
UNIT command to the drive (hmmm... I am not sure that is
a *required* command for disks...).  You might have to also
do a SYNCHRONIZE CACHE command (though I would imagine the
SCSI device driver does that in the device close() call).

You really don't want to twiddle with power while the box
is running (though I flagrantly disregard this advice
routinely  :< ).  First, it's too easy to screw up and
remember to umount everything prior to "pulling the plug".
So, you shutdown the drive and then the system panics
when something you forgot about is suddenly no longer
accessible (like swap!  :<).  Second, it's possible that
you can perturb the SCSI bus during the transition
and upset some other device on the bus.  Or, uncover some
"/* can't happen */" bug in the kernel as the electrical
interface does something "unexpected"  :>

The advantage to sync; umount; spindown is that it is a
reversible operation.  You can later issue a START/STOP UNIT
to spin the drive back up, remount the appropriate file
systems and resume use of the medium.

And, unlike a physical power switch, all of these things
can be done unattended -- in a set of cron jobs if you'd like!

Hope this gets you thinking in other directions...

Holly Hapidays!
--don