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

Allow sync to persistent storage #79

Merged
merged 3 commits into from
Feb 7, 2022
Merged

Allow sync to persistent storage #79

merged 3 commits into from
Feb 7, 2022

Conversation

ecdye
Copy link
Owner

@ecdye ecdye commented Feb 7, 2022

Using the same merge functionality in overlayfs-tools already used to
write changes to persistent storage it is possible to write changes to
disk without completely reseting the zram device. This allows for a
quick sync to persistent storage to be run whenever desired.

Without the ability to sync, any changes made to the underlying
filesystem will be lost if there was a sudden power loss or system
shutdown. This can be mitigated by periodically running the sync command
which will write the changes to persistent storage ensuring that the
data will not be lost if anything goes wrong.

A default service that runs the sync every night is included in this
change, however, it is not installed by default.

Fixes #72

Signed-off-by: Ethan Dye mrtops03@gmail.com

Using the same merge functionality in overlayfs-tools already used to
write changes to persistent storage it is possible to write changes to
disk without completely reseting the zram device. This allows for a
quick sync to persistent storage to be run whenever desired.

Without the ability to sync, any changes made to the underlying
filesystem will be lost if there was a sudden power loss or system
shutdown. This can be mitigated by periodically running the sync command
which will write the changes to persistent storage ensuring that the
data will not be lost if anything goes wrong.

A default service that runs the sync every night is included in this
change, however, it is not installed by default.

Fixes #72

Signed-off-by: Ethan Dye <mrtops03@gmail.com>
@ecdye ecdye added the enhancement New feature or request label Feb 7, 2022
ecdye added 2 commits February 7, 2022 12:21
Signed-off-by: Ethan Dye <mrtops03@gmail.com>
Signed-off-by: Ethan Dye <mrtops03@gmail.com>
@ecdye ecdye merged commit 1a028f7 into main Feb 7, 2022
@ecdye ecdye deleted the zsync branch February 7, 2022 22:28
@mstormi
Copy link
Contributor

mstormi commented Feb 14, 2022

Just wanted to ask you about syncing now seeing you have already implemented it ? Hadn't seen that earlier.
Great ! How much testing did you do ? Is this ready for deployment in openHABian or is (lazy) unmounting impossible with OH running ?

@ecdye
Copy link
Owner Author

ecdye commented Feb 14, 2022

Just wanted to ask you about syncing now seeing you have already implemented it ? Hadn't seen that earlier.

Yeah, I just got that implemented about a week ago.

How much testing did you do ?

Not a ton, however it is using the exact same procedure as when we stop zram-config. The only difference is instead of cleaning up after the overlay merge we remount the overlay filesystem and keep going.

Is this ready for deployment in openHABian or is (lazy) unmounting impossible with OH running ?

Still impossible, as it would cause broken writes the sync still would require stopping openHAB or for that matter any service or program accessing the directory in zram before the merge and the restarting it after. It is merely a simpler way to merge changes than completely stopping zram and restarting it. It could be deployed but I have left it as an optional install here and would probably recommend doing the same there as well. As a side not because of the way I have implemented the sync, there would be no need to manually stop openHAB's services as I use the same custom service identification code that I do in the stop functionality to achieve the service stopping.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add ability to sync files to disk periodically
2 participants