Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How can I turn off without shutting down

0 views
Skip to first unread message

Peter Mitchell

unread,
Aug 7, 2001, 9:40:17 AM8/7/01
to
I want to be able to turn off a Linux system without shutting down
properly.

The system is used as a print server and bridge, and normally has no
screen or keyboard connected. I can shut it down remotely, but this is
a pain, and other people in the house may not do it.

My current method is to use a ramdisk for the root filesystem and to
mount the hard disk (with anything big on it) read-only. However I
would like to be able to write to the hard disk and still be confident
that its filesystem will be intact.

To do this I need to be sure that all data is always written to disk
straight away, ie no write-back caching done by Linux. How can I be
sure that this happens automatically (since there is no screen or
keyboard), and that the disk will always (except during actual
writing) be kept in ready-to-turn-off condition.

I can always use sync to do it by hand, but that defeats the purpose
of not needing anybody to attend to the computer before turning it
off.

Peter

cbbr...@hex.net

unread,
Aug 7, 2001, 9:51:36 AM8/7/01
to
mitchell...@edumail.vic.gov.au (Peter Mitchell) writes:
> I want to be able to turn off a Linux system without shutting down
> properly.

> The system is used as a print server and bridge, and normally has no
> screen or keyboard connected. I can shut it down remotely, but this
> is a pain, and other people in the house may not do it.

[Actually, this is mostly a win. Put duct tape over the switch, and
glue power plugs to system chassis and wall and you've got another win
:-).]

> My current method is to use a ramdisk for the root filesystem and to
> mount the hard disk (with anything big on it) read-only. However I
> would like to be able to write to the hard disk and still be
> confident that its filesystem will be intact.

> To do this I need to be sure that all data is always written to disk
> straight away, ie no write-back caching done by Linux. How can I be
> sure that this happens automatically (since there is no screen or
> keyboard), and that the disk will always (except during actual
> writing) be kept in ready-to-turn-off condition.

> I can always use sync to do it by hand, but that defeats the purpose
> of not needing anybody to attend to the computer before turning it
> off.

This sounds a _lot_ like a case where you'd benefit from having all
the HD partitions that you use be formatted using one of the
journalling filesystems, either ReiserFS or ext3.

Consider it a given that you'll need a boot partition that _must_ be
mounted read-only; the same may be true, hopefully, for the root
partition.

It might then make sense for something ephermal like / and /var to be
mounted as a ramdisk, but for some other "persistent" partition(s) to
[let's say, as it's included in official 2.4.x kernels] use ReiserFS.
--
(reverse (concatenate 'string "gro.mca@" "enworbbc"))
http://vip.hex.net/~cbbrowne/wp.html
PURITAS NECESSE EST -- DON'T DO RANDOM BINDINGS.

Jean-David Beyer

unread,
Aug 7, 2001, 10:40:18 AM8/7/01
to
Hook the machine up to a suitable UPS and connect the cable between the
UPS and the computer. Have the software configured so that when the UPS
signals a power failure, the system does a controlled shutdown. Then
defeat the front panel switch on the computer (short it out inside,
cover it up, etc.) and gave the switch on the distribution strip into
which you plug the UPS plainly marked. They can either power off the
distribution strip, or unplug the distribution strip or the UPS from the
distribution strip and the UPS will think the power failed and do the
controlled shutdown.

--
.~. Jean-David Beyer Registered Linux User 85642.
/V\ Registered Machine 73926.
/( )\ Shrewsbury, New Jersey http://counter.li.org
^^-^^ 10:35am up 4:47, 5 users, load average: 2.07, 2.22, 2.47

Thaddeus L Olczyk

unread,
Aug 7, 2001, 1:03:39 PM8/7/01
to

There is software for linux for a controled shutdown?
Come to think of it, don't different UPSs use different signals?

Dave Brown

unread,
Aug 7, 2001, 1:39:31 PM8/7/01
to
In article <InSb7.21718$_62.19...@news20.bellglobal.com>,
cbbr...@hex.net wrote:
> Consider it a given that you'll need a boot partition that _must_ be
> mounted read-only; the same may be true, hopefully, for the root
> partition.

I've recently been wondering... does a /boot partition need to be mounted
at all, other than when you're using lilo to write the boot record? It
occurs to me that everything required to boot is located by physical disk
addresses, not involving a root filesystem into which /boot has been
mounted. After booting, /boot need not be accessed at all... True?

I guess I'm thinking of AIX, which has its "boot logical volume", (where
the kernel image is stored), *closed* (not accessible) during normal
operation.

--
Dave Brown Austin, TX

joseph

unread,
Aug 7, 2001, 2:14:45 PM8/7/01
to

"Thaddeus L Olczyk" <olc...@interaccess.com> wrote in message
news:3b701f3e....@nntp.interaccess.com...

Use powerd to monitor a serial port.
hook an old external modem into serial port, and switch it on . You should
get a DTR or some signal indicating it is OK.

disconnect the modem, and that signal should change. set powerd to watch
for that change, and initiate a shut down.

Now hook up any ups and plug your system in. But leave the modem plugged
into the wall.

When the power goes, the modem will turn off, but the ups still powers the
computer. Powerd, seeing the changeon serial port will initiate a shut
down.

If you have an atx mainboard, the computer will power-off automatically when
it is shut down ( the kernel needs some stuff compiled in ). The redhat 6.0
kernel does this, and others may. The mandrake 8.0 kernel does not, however.

hth


Thaddeus L Olczyk

unread,
Aug 7, 2001, 4:27:50 PM8/7/01
to
On Tue, 7 Aug 2001 14:14:45 -0400, "joseph" <jos...@lascaux.ca> wrote:

>
>Use powerd to monitor a serial port.
>hook an old external modem into serial port, and switch it on . You should
>get a DTR or some signal indicating it is OK.
>
>disconnect the modem, and that signal should change. set powerd to watch
>for that change, and initiate a shut down.
>
>Now hook up any ups and plug your system in. But leave the modem plugged
>into the wall.
>
>When the power goes, the modem will turn off, but the ups still powers the
>computer. Powerd, seeing the changeon serial port will initiate a shut
>down.
>
>If you have an atx mainboard, the computer will power-off automatically when
>it is shut down ( the kernel needs some stuff compiled in ). The redhat 6.0
>kernel does this, and others may. The mandrake 8.0 kernel does not, however.
>
>hth
>

Hmmm. Would it be possible to use one modem to drive several computers
this way?

Dave Uhring

unread,
Aug 7, 2001, 5:38:33 PM8/7/01
to
Peter Mitchell wrote:

Re-install the system with Red Hat 7.1, but start the install with a CD
burned from the image available at

ftp://oss.sgi.com/projects/xfs/download/Release-1.0.1/installer/updates

You can merrily pull the plug on a Linux XFS all day long and fail to
damage the filesystem. Not recommended, of course, but you can do it.
Reiserfs is not quite as hardy.

Joseph

unread,
Aug 7, 2001, 7:36:11 PM8/7/01
to
Thaddeus L Olczyk wrote:


Well, you could have one master computer that monitors, and if it has to
shut down- I think powerd calls a script to shut down - send a notice to
the others.


If you're asking about one connector to several serial ports, I don't know.
Not an electronics wizzard, I am. Ask around in hardware groups before
frying the serial ports on several computers :)


APC does have some monitoring software for "RedHat" but it was a pain even
in NT.

hth

Thaddeus L Olczyk

unread,
Aug 8, 2001, 1:13:57 AM8/8/01
to
On Tue, 7 Aug 2001 16:38:33 -0500, Dave Uhring <dmuh...@my-deja.com>
wrote:

Is this SGI's XFS?
I thought that was still beta.

fernando

unread,
Aug 8, 2001, 6:20:46 AM8/8/01
to
On 7 Aug 2001 06:40:17 -0700, Peter Mitchell

You can built an infrarred receiver and switch off your computer with
a normal remote control.

http://www.lirc.org


--
--------------------------------------
These are my personal opinions
Real email: sanabriaf at yahoo dot com

Joshua Baker-LePain

unread,
Aug 8, 2001, 10:24:03 AM8/8/01
to

Nope -- 1.0 was released back in May, and 1.0.1 came about a while back too.
I've been using it in production since early April, using a version pulled
out of the CVS tree. It's rather stable, and rather nice.

To get back to the subject at hand, though, just pulling the plug is
*not* a good idea, even with a solid journaling FS.

--
Joshua Baker-LePain
Department of Biomedical Engineering
Duke University

Thaddeus L Olczyk

unread,
Aug 8, 2001, 11:32:30 AM8/8/01
to
On 8 Aug 2001 14:24:03 GMT, Joshua Baker-LePain
<jl...@duke.spam.begone.edu> wrote:

>Thaddeus L Olczyk <olc...@interaccess.com> wrote:
>> On Tue, 7 Aug 2001 16:38:33 -0500, Dave Uhring <dmuh...@my-deja.com>
>> wrote:
>
>>>You can merrily pull the plug on a Linux XFS all day long and fail to
>>>damage the filesystem. Not recommended, of course, but you can do it.
>>>Reiserfs is not quite as hardy.
>
>> Is this SGI's XFS?
>> I thought that was still beta.
>
>Nope -- 1.0 was released back in May, and 1.0.1 came about a while back too.
>I've been using it in production since early April, using a version pulled
>out of the CVS tree. It's rather stable, and rather nice.
>

So do you know a small iso image to create a bootable CD that uses a
kernel with XFS? ( one that will work even when there is nothing
I looked about 4 months ago at XFS and passed, I think for this
reason.
( Or a script that creates a bootable image, by bootable I mean boot
a linux totally independent of what's on the hard drive, even boots
when there is no hard drive ).

>To get back to the subject at hand, though, just pulling the plug is
>*not* a good idea, even with a solid journaling FS.

Agreed. Allthough sometimes it is necessary.

Bill Unruh

unread,
Aug 8, 2001, 12:29:00 PM8/8/01
to
In <3b7259fc....@nntp.interaccess.com> olc...@interaccess.com (Thaddeus L Olczyk) writes:

]>
]So do you know a small iso image to create a bootable CD that uses a


]kernel with XFS? ( one that will work even when there is nothing
]I looked about 4 months ago at XFS and passed, I think for this
]reason.
]( Or a script that creates a bootable image, by bootable I mean boot
]a linux totally independent of what's on the hard drive, even boots
]when there is no hard drive ).

Sure-- that is what all the CD distributions use to boot from their CDs. They
install an operating system purely from the CD-- there is no disk around when
they begin an install!

The print server and bridge however means that you MUST have writable hard disk
space in order to spool the print jobs, etc. If you do not mind your print jobs
being lost, or your bridging crashing( how in the world do you operate a bridge
which can be unplugged at any time-- makes for a very very flakey network!)

You could of course set up a cron job to sync the file system every second.

Joshua Baker-LePain

unread,
Aug 8, 2001, 12:48:39 PM8/8/01
to
Thaddeus L Olczyk <olc...@interaccess.com> wrote:
> On 8 Aug 2001 14:24:03 GMT, Joshua Baker-LePain
> <jl...@duke.spam.begone.edu> wrote:

>>Nope -- 1.0 was released back in May, and 1.0.1 came about a while back too.
>>I've been using it in production since early April, using a version pulled
>>out of the CVS tree. It's rather stable, and rather nice.
>>
> So do you know a small iso image to create a bootable CD that uses a
> kernel with XFS? ( one that will work even when there is nothing
> I looked about 4 months ago at XFS and passed, I think for this
> reason.
> ( Or a script that creates a bootable image, by bootable I mean boot
> a linux totally independent of what's on the hard drive, even boots
> when there is no hard drive ).

Well, it may not be small, but you can boot the 1.0.1 installer CD
with 'linux rescue', and get an XFS-capable-but-otherwise-standard-
RedHat 7.1 rescue mode. It's available here:

ftp://oss.sgi.com/projects/xfs/download/Release-1.0.1/installer/

Like I said, it's not small (300MB), but it'd work. Also, check
the XFS mailing list archives -- I think others have worked on smaller
images.

>>To get back to the subject at hand, though, just pulling the plug is
>>*not* a good idea, even with a solid journaling FS.

> Agreed. Allthough sometimes it is necessary.

Well, yeah, but I think the original question had to do with using the
power cord as the normal means of shutdown, not emergency situations where
even the Magic SysRq won't work anymore.

Thaddeus L Olczyk

unread,
Aug 8, 2001, 2:58:00 PM8/8/01
to
On 8 Aug 2001 16:48:39 GMT, Joshua Baker-LePain
<jl...@duke.spam.begone.edu> wrote:

>
>Well, it may not be small, but you can boot the 1.0.1 installer CD
>with 'linux rescue', and get an XFS-capable-but-otherwise-standard-
>RedHat 7.1 rescue mode. It's available here:
>
>ftp://oss.sgi.com/projects/xfs/download/Release-1.0.1/installer/
>
>Like I said, it's not small (300MB), but it'd work. Also, check
>the XFS mailing list archives -- I think others have worked on smaller
>images.

I seem to remeber Redhat rescue as boot and reading /etc/fstab for
your install. Not good. That's the whole point I want it to be able to
boot even though I have removed all hard drives, because in an
emergency that may be what has effectively happened.

Thaddeus L Olczyk

unread,
Aug 8, 2001, 3:06:41 PM8/8/01
to
On 8 Aug 2001 16:29:00 GMT, un...@physics.ubc.ca (Bill Unruh) wrote:

>In <3b7259fc....@nntp.interaccess.com> olc...@interaccess.com (Thaddeus L Olczyk) writes:
>
>]>
>]So do you know a small iso image to create a bootable CD that uses a
>]kernel with XFS? ( one that will work even when there is nothing
>]I looked about 4 months ago at XFS and passed, I think for this
>]reason.
>]( Or a script that creates a bootable image, by bootable I mean boot
>]a linux totally independent of what's on the hard drive, even boots
>]when there is no hard drive ).

>Sure-- that is what all the CD distributions use to boot from their CDs. They
>install an operating system purely from the CD-- there is no disk around when
>they begin an install!
>

The problem is that the rescue mode with most distros is a *rescue*
mode not a boot mode. They try to read your fstab and mount your
drives. The problem is that if your partitions are roached, you will
have trouble booting with a rescue disk.

What you really want is a totally independent boot from CD. Then
you can mount the hard drives and examine them isolated from the
rest of your system.

Even the scripts that allow you to create a bootable disk do this
read of system fstab.

>The print server and bridge however means that you MUST have writable hard disk
>space in order to spool the print jobs, etc. If you do not mind your print jobs
>being lost, or your bridging crashing( how in the world do you operate a bridge
>which can be unplugged at any time-- makes for a very very flakey network!)
>

For a rescue disk I don't want printing ( or if I do, I copy the stuff
to a floppy and print from another computer ).

I'm not quite clear what you mean by bridging.

Peter Mitchell

unread,
Aug 8, 2001, 11:29:24 PM8/8/01
to
My original question was about normally shutting down with the power
switch. At present it works, but only by setting the hard disks
read-only.

The system boots through lilo, and the default option loads a kernel
from hdc1 and sets up a 4M ramdisk, containing some minimal programs
in /ini/bin, /ini.lib and so on. /bin, /sbin, /lib and /usr are links
to /ini/bin, /ini/lib and /ini/usr. The boot process mounts /dev/hda1,
/dev/hda3, and /dev/hdc1 read-only and changes the links for /bin,
/sbin etc to point to directories on the now mounted drives. /var and
/tmp are kept on the ramdisk.

The system is used in a home network with 3 computers. It is only used
as a bridge to my laptop 3 metres away, so it is left on when this use
is happening. The 4M ramdisk is a bit small, but that's the current
setup.

I would think that a similar system could be used to run from a CD.
You need to remember that it doesn't keep anything, so don't try to
save to it. On mine I change the drives to read-write if I actually
log onto the system, and either shutdown correctly or change the
drives back to read-only when I have finished.

The stuff in the initial ramdisk is basically /etc, mount points,
/ini, /root with a couple of small things there, /var and links for
/bin, /sbin, /lib, /usr, and /tmp. The contents of /ini/bin and
/ini/lib were taken from the RH5.2 rescue floppy (the system is RH5.2,
ie a 2.0 kernel). The kernel was compiled to use my hardware without
modules, to save space in the ramdisk.

Thanks for the ideas. The easiest to implement on this system looks
like cron at close intervals.

Peter

Bill Unruh

unread,
Aug 9, 2001, 3:26:10 AM8/9/01
to
In <3b738c69....@nntp.interaccess.com> olc...@interaccess.com (Thaddeus L Olczyk) writes:

]>Sure-- that is what all the CD distributions use to boot from their CDs. They


]>install an operating system purely from the CD-- there is no disk around when
]>they begin an install!
]>
]The problem is that the rescue mode with most distros is a *rescue*
]mode not a boot mode. They try to read your fstab and mount your
]drives. The problem is that if your partitions are roached, you will
]have trouble booting with a rescue disk.

?? No. They set up a whole version of Linux in memory-- file system and all. You
can mount your partitions on this in memory file system if you want. Rescue disks
are for rescue, including when your partions are hosed.


]What you really want is a totally independent boot from CD. Then


]you can mount the hard drives and examine them isolated from the
]rest of your system.

Yes, for example the Mandrake Rescue mode on their CDs ( at least 7.2 and 8.0) do
just that.

]Even the scripts that allow you to create a bootable disk do this
]read of system fstab.
What makes you think that?


]>The print server and bridge however means that you MUST have writable hard disk


]>space in order to spool the print jobs, etc. If you do not mind your print jobs
]>being lost, or your bridging crashing( how in the world do you operate a bridge
]>which can be unplugged at any time-- makes for a very very flakey network!)
]>
]For a rescue disk I don't want printing ( or if I do, I copy the stuff
]to a floppy and print from another computer ).

]I'm not quite clear what you mean by bridging.

It was you who used the term. Your computer was to be used as a print spooler and
bridge I thought you said.

Joshua Baker-LePain

unread,
Aug 9, 2001, 10:25:22 AM8/9/01
to
Thaddeus L Olczyk <olc...@interaccess.com> wrote:

Somebody posted this link on the XFS list:

http://open-projects.linuxcare.com/BBC/other_BBCs.epl

It's a page with a list of projects that let you create your own rescue
disk. BBC is bootable business card, which is LinuxCare's rescue disk
that they put on business card-sized CDs -- pretty fun, but not XFS capable.

Anyway, a few of the links there look promising.

Molf

unread,
Aug 10, 2001, 6:10:01 PM8/10/01
to

If I press my power button while running Windows, the system goes into
suspend mode (IIRC this required some simple BIOS configuration). I have
not bothered trying to set this up in Linux, but could a similar thing
be configured whereby whatever APM call is sent by the bios when the
button is pressed, causes a properly controlled shutdown?

Yvan Loranger

unread,
Aug 10, 2001, 10:54:16 PM8/10/01
to
Molf (mo...@webtribe.net) writes:
>
> If I press my power button while running Windows, the system goes into
> suspend mode (IIRC this required some simple BIOS configuration). I have
> not bothered trying to set this up in Linux, but could a similar thing
> be configured whereby whatever APM call is sent by the bios when the
> button is pressed, causes a properly controlled shutdown?

Along the similar lines:
If I make the choice in my bios, then hit power button for less than 4
seconds, my system goes into suspend mode, regardless of OS.

--
Merci........Yvan There's an old proverb
that says just about whatever you want it to say.

cbbr...@hex.net

unread,
Oct 6, 2001, 1:01:02 AM10/6/01
to
dhb...@apm6-154.realtime.net (Dave Brown) writes:
> In article <InSb7.21718$_62.19...@news20.bellglobal.com>,
> cbbr...@hex.net wrote:
>> Consider it a given that you'll need a boot partition that _must_
>> be mounted read-only; the same may be true, hopefully, for the root
>> partition.

> I've recently been wondering... does a /boot partition need to be mounted
> at all, other than when you're using lilo to write the boot record? It
> occurs to me that everything required to boot is located by physical disk
> addresses, not involving a root filesystem into which /boot has been
> mounted. After booting, /boot need not be accessed at all... True?

You're right, there; it doesn't normally need to be mounted.

The "must" that I was indicating was for the read-only status, as
opposed to the partition necessarily having to be mounted...
--
(reverse (concatenate 'string "gro.gultn@" "enworbbc"))
http://vip.hyperusa.com/~cbbrowne/sgml.html
What should you do when you see an endangered animal that is eating an
endangered plant?

0 new messages