Sync VM filesystem before snapshot to prevent data loss#46
Merged
Conversation
Signed-off-by: Dale Fu <Dale.Fu@ibm.com>
Contributor
Author
|
@rahulssv-ibm Can you double check this for ppc64le env? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add filesystem sync before VM snapshot to prevent data loss. Late-stage file writes (e.g., /etc/sudoers.d/runner) can remain in the guest VM's page cache when
lxc snapshotcaptures the virtual disk. This causes those writes to be silently lost in the published image. Addingsyncinside the VM before snapshotting ensures all pending writes are flushed to the virtual disk.How it was found
VM images were missing passwordless sudo for the runner user. The sudoers file was written correctly during the build (confirmed via build logs), but was empty or absent when launching a VM from the published image. Disabling cloud-init confirmed the file was never in the image. A manual test with
syncbefore snapshot resolved it.