It's a "feature" that would substantially cripple the OS, because it would either have to constantly sync writes, or not write at all. You can set the root filesystem up as read-only and accomplish exactly that, but you will probably find that is more, not less of a hassle overall.
– goldilocks♦Jan 14 '14 at 9:00

6 Answers
6

No OS that exists has this feature. There are operating systems that can recover from it better than others, but no system can avoid it.

This is because OS's are constantly transferring data from one place to another. When you are using your system, there is a lot more transferring of data going on than if you were just letting the system sit idly. When you shutdown your system abruptly, you run the risk of your halting you OS transferring important data.

This is why you will usually see a message of some sort telling you to not shut down your computer when you are updating. Doing so will destroy the system, and it can't recover from that by itself.

Sorry, but I feel that's wrong. Many operating system have such a feature, because many OS don't write data (think of old school game consoles). The question is if such an OS exists for the pi and if it fulfills the need
– rdmuellerJan 13 '14 at 16:35

@Ralf You shut off your computer next time you are updating it and tell me I'm wrong. Any time the write operation is cut off there is corruption.
– syb0rgJan 13 '14 at 20:54

1

@Ralf : sybOrg is correct in so far as there are no general purpose operating systems like this. ROM cartridge game consoles, microwave ovens, your watch, etc. generally have little or no storage to write to anyway, and are limited by that...if you want an Apple TV, buy an Apple TV, not a Raspberry Pi development board.
– goldilocks♦Jan 14 '14 at 8:58

1

@Ralf : It's possible to configure a normal linux distro to not use any permanent read-write storage. Many embedded systems (such as the appliances I mentioned) work this way. It is not so much a question of "a different OS" as understanding what the issue is, and that if you do configure it that way, there are a bunch of limitations included. So it depends what you want to do with the pi. The OP implies general purpose use; if Michal wants a game console, great, but then the question becomes very different.
– goldilocks♦Jan 14 '14 at 10:37

1

@goldilocks: but I guess our discussion already will help him in solving his problem :-)
– rdmuellerJan 14 '14 at 10:41

One thing you can do to reduce the impact on the SD card with the Pi is to use a USB stick for the root directory: There are instructions here. The SD card willstill be used at boot time, but is basically untouched during other operation; as a result, you don't get nearly as much sd card corruption.

May be I am wrong, but the SD card will only be corrupt if you shut your pi down in the middle of a write operation.
So, most of the time nothing will happen when you abruptly shut it down.
If you want to make sure that it will not break, use an operating system which does not write to the SD-card. Those systems are often called 'live'-cd. Thry often have the option to mount a usb drive as wtitable medium in oder to store some changable data.
But even when you shut down your pi during a wtite process, the damage depends on the filesystem and on which data it was about to write. Most of the time, only this data file will be corrupted.

Uodate: look for journaling file systems. Afaik reiser fs is one. These file systems are build to recognize corrupt files and restore them. So if you manage to use such a fs, you should be nearly on the safe side, even when your app writes a lot of data. Nearly, because even those file systems cann bring your files in an inconsistent state. For instance when your app tries to make a change in two files but only one of them is corrupted.

+1 I've had to yank the power on the pi (while it is relatively idle) dozens of times and never had a problem -- which is not to say it is okay. Like most of us, I've also turned off "normal computers" without shutdown, or had the power fail. Note the pi is exactly the same as a normal computer in this sense. If pis are more prone to mysteriously corrupting SD cards than, e.g., phones and cameras, it is a hardware issue and the OS won't make a difference. ext4, the default fs used by most pi distros, is a journaling filesystem, BTW.
– goldilocks♦Jan 14 '14 at 9:07

1

In ext3/4, which is also journaling, you can extend the commit time, i.e. the time between writes. This reduces the probability that you shut-down in the middle of one.
– FredMar 24 '14 at 9:55

You can set up Debian / Raspbian to read only mode. This will give you an os that would not corrupt your SD card on shutdown. Note that some locations must remain writable such as /home/pi. That may or may not be an issue depending on your setup.

Also, some folders that do require writing such as /tmp may be mounted on RAM.

If you don't need to make changes to your OS and you don't care about logs or other data that automatically writes to SD, you could put the SD card in Write protected mode. Any time you want to add changes or update the OS, just switch it back to read-write, and then back again when you finish.