How to force a FAST emergency shutdown?

Asked by ZioNemo on 2012-01-30

I have the need to preserve disk integrity across a power failure.
I cannot use the normal means (i.e.: use a PSU), so the delay between when I can detect power loss and the actual end of juice is <100msec.
I know there's no time for a clean shutdown even using Alt + Sysrq + REISUO or programmatic equivalent.
I don't care for the data of any program that may be running in that moment.
What I need to ensure is that when the mains is back the machine will boot (more or less) cleanly.
Nowadays sometimes I'm stuck at a command-line prompt by a failed fsck (run fsck manually....),
Can someone suggest the fastest possible emergency shutdown?

Question information

English Edit question
Ubuntu linux Edit question
No assignee Edit question
Last query:
Last reply:
mycae (mycae) said : #1

100msec is not very long. A 5400rpm drive will only have time to do 9 rotations. If you have to touch 10 different positions on the drive, then you might not get them all, even if your transfer or execution is perfect.

Why not just force fsck to run automatically on boot?

ZioNemo (zionemo) said : #2

Disk is SSD, so latency should be lower.
Problem with fsck at boot is it often drops you into a root shell wit he message: "run fsck manually, i.e. without -p or -a..."
This renders the system unusable without direct intervention... especially since this is an headlessmachine.

Question really is:
What is the fastest, reasonably diskwise clean, emergency shutdown I can achieve? and how?

Grab a cheap UPS and you'll be ok.

mycae (mycae) said : #4

>This renders the system unusable without direct intervention... especially since this is an headlessmachine.

Why not just disable the question? I believe this can be done with a variable in your init.

ZioNemo (zionemo) said : #5

As stated in the original post:
using UPS is not an option.
Can someone answer to the question? please?
I already explored other possibilities.
What's the fastest way I can use to secure disk?

mycae (mycae) said : #6

>Can someone answer to the question? please?
Probably not - you are asking how to do something the system is not supposed to do - operate stably without a steady power supply.

You'd have to send sigkill to all processes, swap off, unmount all drives, then unmount /. Normally you do this with shutdown -h now, but this waits for a few seconds before and after issuing sigkill.

This would take time, and may not work in cases such as zombie or uninterruptible processes, or many backend kernel things that I don't know about.

Phillip Susi (psusi) said : #7

You're not going to be able to do anything once the power is already failing. Are you using an unusual filesystem, or maybe is this a Wubi install? With ext3 or ext4 ( default now ), loss of power won't cause a problem booting up afterwards.

Can you help with this problem?

Provide an answer of your own, or ask ZioNemo for more information if necessary.

To post a message you must log in.