2

I wanted to ask if ubuntu-core by design is behaving more like a ramdisk based OS? According to this page:

The OS and application files are kept completely separate, as a set of distinct read-only images.

which I understand as there are far less write operations done to the physical storage - I'm thinking of an SD card in my particular case. Would result in a more power-failure resistant storage (of course not talking about damaging the SD card itself)?

For reference - I have not too good experience with rPi's and their SD card based FS (don't get me wrong, I like them but they don't fit all of my use cases) which ended up corrupted... No matter what class of SD card I'd use I always ended up with a damaged system after some time. From what I've read this is normal since by default there's a lot of writes done by Raspbian and if power failure happens during write it makes the whole system not bootable.

As in some events I don't always have the luxury of shutting the system down with a proper shutdown thus I'm looking for an OS more resistant to this and ubuntu-core seems to promise this. Am I understanding this right?

2

This is a great question.

Snaps (and thus Ubuntu Core) are indeed designed so that each (the OS is just another snap) is isolated from the others. Snaps are read-only squashfs images, which is what the quote to which you refer is discussing.

However, as I understand it, this was not done to behave like a ramdisk OS. It was done for the other bullet points on that page:

  • The images (and applications within them) are more resistant to tampering.
  • The snap is always exactly what the developer released, which makes it easy to update (and rollback).

And so on. In fact, while the snaps are indeed read-only, Ubuntu Core doesn't behave like a ramdisk OS:

  • The snaps themselves are still written to disk when they're updated.
  • The OS logs still go to /var/log/.
  • Each snap has its own slice of writable space which it can utilize how it sees fit.

All of these writes are persisted, but the system was designed to make writes as minimal as possible (unless you're running snaps in devmode, which makes the logs noisy, or using a snap that writes a ton). As far as power failure goes, there's nothing that prevents a power loss during one of these writes. However, both Ubuntu Core and Raspbian (I believe) use ext4 which is typically able to recover from such events. I'd go so far as to suggest the previous SD card corruption you've encountered is simply due to excess writes. Perhaps your SD card of choice doesn't have a good wear-leveling implementation?

1
  • Thank you for your answer. As far as SD cards I've used they were most likely Sandisks Extreme (usually use them) and the cards were ok after I've rewritten them with a new Raspbian image. So physically they were ok, just the system on them failed for some reason. Following up on your feedback it seems that the Ubuntu Core design could offer somehow improved resistance to power failures. If a individual snap or logs get corrupted it would still not render the whole OS unbootable is in my previous rPi experiences. The problem with this is that it's hard to test reliably and repeatedly – P_B Oct 5 '16 at 17:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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