Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make root readonly, create a partition for persistent data #159

Merged
merged 1 commit into from
Sep 22, 2024

Conversation

nisargjhaveri
Copy link
Owner

In an attempt to reduce SD card failures due to power outages when being written:

  • Create a new partition and mount it at /persist. Use this partition for things we need to persist like the bluetooth connection info.
  • Make root readonly, reducing the chances of unnecessary writes to the sd card.

@nisargjhaveri
Copy link
Owner Author

This should help with #138 and #109. This seems to reduce SD card writes. It only writes on boot or when bluetooth is connected. Would be great if more people can try out.

Not sure what else was continuously writing on root though. Logs are anyway on tmpfs. But this looks like a good idea anyway to reduce chances of some service accidentally writing.

@pavitra14
Copy link

pavitra14 commented Sep 1, 2024

Flashed this today, Let's see how it goes!
Thanks @nisargjhaveri !

Update: Haven't faced any issues with the card anymore.

@BaderSZ
Copy link

BaderSZ commented Sep 10, 2024

While we're at it, could you also make /var/log link to /persist/log?

Ideally, this would only be the case for 'development' images, but since those aren't released, it should be fine as is. The question is what to do if the partition is full (BR2_PACKAGE_LOGROTATE?)

@nisargjhaveri nisargjhaveri mentioned this pull request Sep 12, 2024
@nisargjhaveri
Copy link
Owner Author

@BaderSZ having logs writing to sd card will increase the chances of sd card corruption by a large margin. I don't think it is wise to persist logs by default.

Having separate development images is a good idea, or I was maybe thinking of having a config that can enable logs to persist.

@BaderSZ
Copy link

BaderSZ commented Sep 12, 2024

@nisargjhaveri that is true, hence my suggestion for the dev image as a workaround, as opposed to people building their own. Alternatively, writing the logfile at set intervals to the SD card is also an option, but I am not aware of an easy way to do that with buildroot.

@nisargjhaveri nisargjhaveri merged commit 417ad20 into main Sep 22, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants