Overlay: Add option for /persistent directory to survive reboots#135
Overlay: Add option for /persistent directory to survive reboots#135mariusmarais wants to merge 1 commit into
/persistent directory to survive reboots#135Conversation
If `/persistent` directory exists, it will be remounted over the overlay, allowing its content to survive reboots. The `/persistent` directory must be created before the enabling the overlay.
|
As far as I know, the SD card should be considered safe (e.g., against power failures) if its whole data is in read-only mode (consumer SD cards do not physically map logical filesystem partitions). In your case, if one is writing to |
|
Sure, if that is your concern. Otherwise it is a probability thing: (a) power failure exactly when you're writing to a specific location, or (b) at any point really as things are generally running and writing. If you put a live MySQL DB in there all bets are off. The original reasoning was actually not to protect against SD card failure -- I used this while booting from USB in any case. I wanted a 99.9% immutable system since that's easier to manage and script. But this was clearly the wrong place to contribute 😄 |
|
Ah, ok. I was considering this because of the rw remount. Your usage of |
|
Looking at it now, I can't actually recall exactly why it's done like that anymore, but I think it was partly to make the script diff easier to understand. Also, not taking wildly different branches for this feature, but rather just adding a little something. 😄 |
This adds an optional persistent directory that will survive reboots.
A user opts in by creating a
/persistentdirectory before enabling the overlay.During boot, if the
/persistentdirectory exists, it will be mounted in read/write mode, making its content survive reboots.But why?
Persist some data across reboots while still keeping 99.9% of the system read-only.
Anything written there will survive reboots, including via symlinks from the rest of the system.
(The symlinks should normally be created before enabling the overlay, otherwise they won't survive the reboot themselves.)
After enabling:
Note: Only
/persistentis available, not the entire root partition.