How resilient is Ubuntu to repeated "power-off" shutdowns?

Note: this answer is from the perspective of a production environment where data loss or downtime can lead to loss of money, customers, industrial equipment malfunctioning, etc. If you are just tinkering with a Raspberry Pi at home, I'd say there's no problem... :)

I would not recommend Ubuntu in its default configuration, and the (default) ext4 filesystem by design, for an embedded environment where there would be repetitive "ungraceful" shutdowns like you suggest.

If I'm correct, you're using Ubuntu 8.04, which supports ext3 at best. While both ext3/ext4 use journaling as a way to maintain file (write) integrity and to aid in recovery, these should not be relied on when "pull the power cable" is the rule rather than the exception.

  • The ideal option, assuming that your system will not need dynamic reconfiguration once set up, is to mount its root filesystem read-only and to entirely use a temporary in-memory partition when operational (like the LiveCD does). In this case, the system would return to its "initial" configuration whenever booted up.
  • To store (a limited amount of) user data in a non-volatile way, you could create a secondary partition, perhaps using a filesystem optimized for flash media such as JFFS2 depending on the internal structure of the CF card. To reduce the chances of data corruption by pulling the plug, you could disable hardware write caching for the device, and mount it in synchronous (sync) mode, disabling write caching by the kernel. These options may severely affect throughput and performance, even on a "high-end" CF card, so you would have to take the intended use into consideration too.

The Operating System will be fine as long as it is setup for read-only use. LiveCD's have a setup like that, so that you can power them off at anytime, and the OS will not suffer harm.

On a read-write drive, ext4 filesystems are very resilient. But no matter the filesystem, any drive that is writable will be subject to corrupt files.