fix: reduce snapper timeline limits to prevent disk fill#2167
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses critical disk space issues on cloud VMs by refining the Btrfs snapshot management through Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request addresses an important issue of disk space consumption by reducing the number of snapper snapshots. The changes to the timeline limits and the disabling of the redundant snapper-timeline.timer are well-justified and should prevent disk pressure on VMs with smaller disks. I have one suggestion to make the sed commands more robust against future changes in the base image.
| - [sed, '-i', 's/TIMELINE_LIMIT_HOURLY="10"/TIMELINE_LIMIT_HOURLY="0"/g', /etc/snapper/configs/root] | ||
| - [sed, '-i', 's/TIMELINE_LIMIT_DAILY="10"/TIMELINE_LIMIT_DAILY="3"/g', /etc/snapper/configs/root] | ||
| - [sed, '-i', 's/TIMELINE_LIMIT_MONTHLY="10"/TIMELINE_LIMIT_MONTHLY="0"/g', /etc/snapper/configs/root] | ||
| - [sed, '-i', 's/TIMELINE_LIMIT_YEARLY="10"/TIMELINE_LIMIT_YEARLY="0"/g', /etc/snapper/configs/root] |
There was a problem hiding this comment.
The sed commands rely on the default value being exactly "10". If the base image changes this default in the future, these sed commands will silently fail to apply the configuration, re-introducing the disk-fill issue.
Using a more robust pattern that matches the key and replaces any value will prevent this. I've also removed the unnecessary g flag.
- [sed, '-i', 's/^TIMELINE_LIMIT_HOURLY=".*"/TIMELINE_LIMIT_HOURLY="0"/', /etc/snapper/configs/root]
- [sed, '-i', 's/^TIMELINE_LIMIT_DAILY=".*"/TIMELINE_LIMIT_DAILY="3"/', /etc/snapper/configs/root]
- [sed, '-i', 's/^TIMELINE_LIMIT_MONTHLY=".*"/TIMELINE_LIMIT_MONTHLY="0"/', /etc/snapper/configs/root]
- [sed, '-i', 's/^TIMELINE_LIMIT_YEARLY=".*"/TIMELINE_LIMIT_YEARLY="0"/', /etc/snapper/configs/root]
|
Thanks @stufently, this snapper timeline growth fix is included in the v2.19.3 patch train here: #2183. Your contribution is preserved in the branch history and packaged as part of the patch release reliability fixes. Once #2183 lands, this PR can be closed as included. |
Summary
TIMELINE_LIMIT_*) to the existing snapper sed block in cloud-initsnapper-timeline.timer— redundant sincetransactional-updatealready creates pre/post snapshotsValues applied
NUMBER_LIMIT2-104(unchanged)NUMBER_LIMIT_IMPORTANT4-103(unchanged)TIMELINE_LIMIT_HOURLY100TIMELINE_LIMIT_DAILY103TIMELINE_LIMIT_MONTHLY100TIMELINE_LIMIT_YEARLY100snapper-timeline.timerWhy these values
transactional-updatealready creates numbered pre/post pairs for every OS updateImpact
cloudinit_runcmd_commonpreinstall_execRelated discussions
Follow-up (if desired)
If users need fine-grained control, a
snapper_configvariable with these as defaults could be added in a follow-up PR. This keeps the current change minimal and focused.