Can Linux Work Without Shutdown? 61
Glen Raphael submitted this odd question
a while ago: "Suppose I have a test tool
running under Linux in an environment where
the power is expected to die often and for
long periods of time without any warning
(and buying a UPS isn't an option).
How can I make it safe to just turn off the
power to the PC running Linux without
properly shutting down?" So what is one
to do when they want to run a Linux box
and they can't trust their outlet?
Glen continues... "It's okay for fsck to run at startup but I want to minimize the damage it has to repair and I want to entirely avoid the need to boot as root in order to repair major damage. What can I do to accomplish that goal? Performance is not an issue. I thought of doing a "sync" every minute or so, but that seems silly. Is it possible to turn off disk caching instead and if so how do I do that? What else can or should I do in software to ensure that you can turn off the Linux machine by hitting the power switch or cutting power to the building and not expect major repairs when the power comes back up?
(Side note: If this problem can't be solved, the favored alternative is to give up on Linux and rewrite the tool using DOS. Right now I'm using RedHat 5.1 or 5.2 on a generic Pentium notebook.) "
Smarter power supplies... (Score:1)
Well... (Score:1)
The reason you have to shut down is because you have mounted partitions as rw. If you don't need to write to them, you could always mount everything ro and then it shouldn't even fsck on boot. I think. I'm not going to try it. :)
It's obvious you will need to write something, and you might be able to turn off the caching for that particular partition.
It's really too bad you can't buy a UPS. Then you could hook it up to init to shut down the computer when it gets a powerfail signal...
Serial Cables (Score:1)
I don't know, I haven't actually used one. I would assume given a halfway decent one (read: not the cheap consumer-quality kinds) they come with all the hardware and information you need. I believe there is documentation either with the kernel or with init that talks about this... I believe it was with the kernel... check it out.
Smarter power supplies... (Score:1)
I think the problem with this is that full size units consume a LOT more power than a laptop and thus eat battery power candy. I have a 250VA UPS on my 233MMX, 3HD, 1CD, 17" an it only last like 2 min before it is dead. I don't think the batteries from laptops have that much capacity.
Not sure I understand why a UPS is not possible (Score:1)
Not that much. One that will outlast the momentary power losses, and then allow an orderly shutdown can be had for about USD100. Unless you are a student you can afford that.
Use the sync option to mount (Score:1)
Suspend to disk in Linux (Score:1)
>it enters save to disk mode. This feature >requires a fat or fat32 partition.. (because of >the program that creates the file in which the >data is stored)
>
>what happens is the ram (32mb) is saved to that >file. it isnt supported in linux.
Untrue! Linux 2.2 either supports, or there is a patch for, suspend to disk. It's been discussed on linux-kernel a bit, and I know some generated a patch which supposedly works well. I don't know if it got added to the official kernel, though. Try looking in the kernel list archives.
go remote? (Score:1)
I run a NFS-Root workstation that boots from floppy and then gets its disk over NFS. It *can't* cleanly shut down, since it doesn't know what to do after the filesystems are unmounted. I've been just turning it off for a year, haven't had any problems (but hopefully someone will tell me if I'm being lucky). The server deals with keeping the disks happy.
Serial Cables (Score:1)
shutdown (Score:1)
The best way to handle it is to mount everything you can read-only. I've been experimenting with mounting everything read only and then mounting a ramdisk as an overlay filesystem allowing the system to be written to, as long as the files you write to don't need to be saved.
Another way is to mount a ramdisk as a partition, copy off a read only partition, and periodically mount the original partion read/write, sync the two, and remount it read only.
Why not use UMSDOS? (Score:1)
prompt is because SMARTDRIVE will sync the
disks before the prompt is displayed.
That's easy nuff to do in bash
PS1="`sync`\$ " or whatever...
--
e2fsck -p (Score:1)
for temporary storage. Mount the rest RO or run everything from RAM as suggested.
If you have e2fsck in your start-up scripts, add
"-p" option to it.
Inexpensive UPS (Score:1)
Check out MGE's site here [mgeups.com]
DOS is just as vulnerable (Score:1)
Not sure I understand why a UPS is not possible (Score:1)
--
APM Support (Score:1)
You could always use NT... (Score:1)
Here's how I would do it.. (Score:1)
Here's how I would do it.. (Score:1)
Turning off in a jiffy (Score:1)
-- ----------------------------------------------
Vive le logiciel... Libre!!!
Smarter power supplies... (Score:1)
How about a powersupply with a battery built in, so that a powerloss will switch to battery, which in turn can be detected (laptops tell you when they're on mains or bat) and which could then force an immediate shutdown. The battery for this type of powersupply wouldn't even need to be real big. 5-10 minutes would surely be enough. In other words, batteries out of ancient laptops would suffice...
Does anyone know of such a project already having been attempted? What is wrong with this idea? Would it be possible to build such an animal to just replace a normal power supply in a desktop box? Or does a desk top box just simply suck way too much juice for a battery to even cope for an immediate shutdown?
Ralf
http://www.dstc.edu.au/~ralf [dstc.edu.au]
Ram-disk based Linux (Score:1)
If you have a bit of ram... (Score:1)
during boot, create some ramdisks.
copy the contents of
remount all disk partitions ro.
remout
That solution works, but requires ram, and requires not needing real write access to the harddrive ever.
a few unanswered questions (Score:1)
2) have you though about 'embedding linux'? it is possible to embed the linux os in a device. I saw in the LJ (I think it was the linux journal) that the car mp3 player had 3 linux embeded oses running (2.0.35, 2.0.18, and cannot remember the other one) a mini cluster there (hehehe).
does it have to be a desktop computer or can it be an embeded device?
3) why is ups an unacceptable solution?
4) what is this tool doing as it runs? (reading files, reading info from a port, writing data to files)?
on a solution note
1) it is possible to spin down disks (on most systems that is) hdparm
2) it is also possible as many have said to use ram disks..
3) and lastly have you thought about running the filesystem from a cdrom linuxpro has a distro that this can be done, then it is automatically mounted read only.. it would be interesting to have the / filesystem on cdrom, and the home directory in a ram disk and set up a diskless system.... or a system with a very small hard drive..
Serial Cables (Score:1)
And I purchased it for quite cheap at www.egghead.com
Solid state (Score:1)
Not sure I understand why a UPS is not possible (Score:1)
how to disable swap? (Score:1)
1. To disable swap until you re-enable it, comment out any lines in your
2. To disable swap until the next reboot, just use the swapoff command: swapoff -a
To turn it back on, issue a swapon.
DtFS WOULD BE what you want (Score:1)
Dtfs is an ext2fs based log-structured filesystem.
(something like journaling filesystems). It logs all modifications of the fylesystem in an efficient way so that only the latest instructions that occurred during power failure are lost. And you can also undelete, undo some operations so that you can set the disk back to a safe state.
http://www.complang.tuwien.ac.at/czezatke/lfs.h
The driver is still incomplete though.
Turning off in a jiffy (Score:1)
It doesn't sound like he likes the idea of you getting work done. Too bad for him that his temper gets in the way of business.
Keeping those disks synced (Score:1)
to be told to flush data to disks before taking
them away. I can accept having to unmount NFS shares and the like, but why my floppy drive, or even worse, READ ONLY CD DRIVE!
IMHO it'd be good if the OS still didn't block on writes, in that cp asdfsdf
Using DOS Instead? (Score:1)
I don't see your problem. fsck is a very smark programme and whatever fixes it does genereally does not destroy anything. In may case, I designed a system that is running in an environment that is subject to power failures. When it comes back on line it generally reports only a new missing blocks and i-nodes. My software is smart enough to know how to this sort of thing.
As for your particular application, if you need the data to be on the disc as soon as it is written, youn programmes can always call sync(). Not only is it a command, but it is part of the interface library.