1

I am prototyping a new embedded system that uses ext4 on Flash memory. These systems will be remotely deployed with no local sysadmin, so any diagnostics must also be done remotely via a network.

The default mount option for ext4 is to set the FS to read only when it encounters an error. I think this is too severe for my case, as it can cause many operations to cease working and prevent remote logins.

I would prefer to keep the system running (and tolerate some FS errors). So for my case the mount option "errors=continue" seems more appropriate. However, I would like my application to be notified when any FS errors occur so it can log these as high priority problems and send that info. back to our servers.

Does anyone know if this can be done with the stock Linux kernel (4.8.1 on x86_64)?

1
  • 2
    Have you considered making / and /usr read-only by default and having a separate writable filesystem for /var/log and your program's data? If the writable filesystems become un-fsckable, you can remake them and restore from a backup or a prototype. Commented Dec 17, 2016 at 20:26

1 Answer 1

2

I would prefer to keep the system running (and tolerate some FS errors)

This is a contradiction in terms. When you get FS errors, your system won't be running for long. In fact, running with errors=continue is very likely to further damage a corrupt filesystem until there is not even any hope of sensible recovery.

If you want your application to make a best stab at continuing operation even if there are FS errors, it should have a script that detects when / has gone read-only, and reboot with a forced fsck.

At some point everything goes bust. It's the law of increase of entropy. There isn't anything you can really do about it, other than adhere to solid engineering principles and get high-quality parts for mission-critical use cases.

3
  • That is a fair comment. However, if I were to immediately switch the FS to R/O, then reboot and fsck, what's the stop the system getting stuck in an infinite loop of rebooting? After all, we cannot guarantee an fsck will fix everything, can we?
    – SeanLabs
    Commented Dec 17, 2016 at 19:20
  • @user411180 That's what my third paragraph says ;). You can have a counter so that it stops trying after the Nth fsck. Commented Dec 17, 2016 at 20:10
  • I think I will try and test something based on these suggestions; thanks.
    – SeanLabs
    Commented Dec 17, 2016 at 20:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .