I am developing an embedded Linux system that runs on compact flash and tmpfs. The flash is read-only and usually should stay that way, but sometimes I need to write something to a USB flash drive.
What precautions should be taken when recording to flash (via PATA)? For reasons that I can’t remember, I use the ext4 file system mounted with barrier=1,data=ordered,nodelalloc,noatime,ro . Is there any terrible idea? The system should boot quickly with zero interference. I am tempted to do tune2fs -c 0 -i 0 . Is this an even worse idea?
Also, when I write something, I obviously need to remount flash-read-write, write, and then read-only remount. The problem is that there are several different processes (both C ++ binary and shell scripts) that may be required for this. Obviously, every process indiscriminately restores a read-only file system when this is done is a bad idea.
What is the best way to coordinate this? flock looks promising; is this the best way to go and what do i need to worry about? I do not want an outdated lock to block writing or leave the file system unlimited.
To clarify: “Sometimes” I write, I mean that the system can last for years without requiring anything to be written. When something is written, it may be a couple of hundred bytes. At the same time, the system must withstand unpredictable energy cycles without any intervention.
linux filesystems locking embedded embedded-linux
eater
source share