4

There are a bunch of operating systems available to download for the Raspberry Pi.

I wonder if there is a OS that would not corrupt the file system/SD card when unplugged from power source without proper command (sudo shutdown -h now).

Here is the (presumably) full list of all the OS distributions available on the Raspberry Pi.

Does any of the systems above has that feature so that the rapid unplugging won't hurt any of the files/filesystem/SD card?

1
  • 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, 2014 at 9:00

6 Answers 6

1

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.

6
  • 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
    – rdmueller
    Jan 13, 2014 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.
    – syb0rg
    Jan 13, 2014 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, 2014 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, 2014 at 10:37
  • 1
    @goldilocks: but I guess our discussion already will help him in solving his problem :-)
    – rdmueller
    Jan 14, 2014 at 10:41
1

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.

1

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.

2
  • 1
    +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, 2014 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.
    – Fred
    Mar 24, 2014 at 9:55
1

The distribution Tiny Core Linux runs mostly in RAM. From their website:

As a quick summary, Tiny Core: Loads itself into RAM from storage, then mounts applications on storage, or installs applications to RAM from storage.

If all your applications fit into RAM and do not require writing to the SD card, it should allow a setup that would not be damaged when unplugged from power source without proper shutdown.

PiCorePlayer is a special purpose linux distribution that also runs also completely in RAM most of the time.

0

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.

-1

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.

1
  • RPi does not care about the position of the rw/ro switch, it it always possible to write.
    – lenik
    Jun 16, 2014 at 15:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.