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

fix: ensure passive.img is sparse after install (backport #960) #970

Merged
merged 1 commit into from
Feb 13, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions package/harvester-os/files/usr/sbin/harv-install
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,14 @@ do_mount()
mount ${PERSISTENT} ${TARGET}/usr/local
}

sparsify_passive_img()
{
# See https://github.com/harvester/harvester/issues/7518
echo "Ensuring passive.img is sparse..."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this interesting fix, just a question:

To be more secure, should we test if ${STATEDIR}/cOS/passive.img) is there first? There is no passive.img definition on Harvester code, elemental has following information

https://github.com/rancher/elemental-toolkit/blob/50f6b4ec667767ef4e7c1036866a2d0180221044/pkg/constants/constants.go#L195

https://github.com/rancher/elemental-toolkit/blob/50f6b4ec667767ef4e7c1036866a2d0180221044/docs/content/en/docs/Getting%20started/upgrading.md?plain=1#L68

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not overly concerned about that here -- we run elemental install a few lines above sparsify_passive_img, and elemental install is what creates passive.img in the first place, so it will always be present at this point.

echo " was: $(du -h ${STATEDIR}/cOS/passive.img)"
fallocate --dig-holes ${STATEDIR}/cOS/passive.img
echo " now: $(du -h ${STATEDIR}/cOS/passive.img)"
}

preload_rke2_images()
{
Expand Down Expand Up @@ -537,6 +545,7 @@ do_data_disk_format
# Preload images
do_detect
do_mount
sparsify_passive_img
get_iso # For PXE Boot
save_configs
save_wicked_state
Expand Down
Loading