Btrfs snapshot retention configuration on OpenSUSE minimal-install servers
0 reputation · 22 Feb 2024, 07:03 UTC
0 reputation · 22 Feb 2024, 07:03 UTC
OpenSUSE's default installation enables Btrfs snapshot auto-creation via snapper for system and user data. On low-traffic servers with minimal workloads, this feature can lead to unbounded disk usage if retention policies are not explicitly configured. The trade-off between convenience and storage cost becomes critical when running cost-sensitive deployments where storage quotas directly impact operational expenses.
The core uncertainty lies in whether the default snapper configuration (typically 25 hourly, 10 daily, 5 weekly, and 3 monthly snapshots) is appropriate for servers that rarely undergo changes. For workloads that generate minimal filesystem modifications, maintaining such a large snapshot history may be unnecessary and financially wasteful.
Key considerations include determining optimal retention values that balance recovery needs against storage costs, and understanding how snapshot auto-creation interacts with other system services in minimal-install patterns.
patterns-minimal package affect the default snapper configuration or snapshot behavior?32775 reputation · 22 Feb 2024, 08:34 UTC
For low-traffic servers running OpenSUSE Leap or Tumbleweed with minimal installation patterns, the default snapper retention (25 hourly, 10 daily, 5 weekly, 3 monthly) is typically excessive. To reduce storage overhead while maintaining a viable recovery window, the following limits are recommended for the root configuration:
| Setting | Recommended Value | Purpose |
|---|---|---|
TIMELINE_LIMIT_HOURLY |
6 | Covers the last 6 hours of changes. |
TIMELINE_LIMIT_DAILY |
7 | Provides one week of daily recovery points. |
TIMELINE_LIMIT_WEEKLY |
2 | Long-term stability check. |
TIMELINE_LIMIT_MONTHLY |
1 | Minimum monthly archive. |
NUMBER_LIMIT |
10 | Limits total numbered (pre/post) snapshots. |
NUMBER_LIMIT_IMPORTANT |
5 | Protects critical system updates. |
If the server is extremely static and storage is critical (e.g., root partition < 20 GiB), consider setting TIMELINE_CREATE="no" to disable automatic timeline snapshots entirely, relying solely on numbered snapshots triggered by zypper updates.
The patterns-minimal package does not alter default snapper behavior; it removes GUI tools but leaves the Btrfs snapshot infrastructure intact. To apply these changes, edit /etc/snapper/configs/root and execute the following to force immediate cleanup:
# Force cleanup of snapshots exceeding new limits
snapper -c root cleanup number
snapper -c root cleanup timeline
To ensure snapshot growth is bounded and the cleanup mechanism is functioning, use these commands:
snapper -c root get-config | grep -E "TIMELINE_LIMIT|NUMBER_LIMIT"systemctl is-active snapper-cleanup.timerbtrfs filesystem usage /snapper -c root list --type timeline | wc -lThese recommendations assume the use of the default OpenSUSE Btrfs layout where qgroups are enabled for quota tracking. If btrfs qgroup show / returns no data, per-snapshot size accounting is disabled, and you must rely on btrfs filesystem usage for global disk health. Note that reducing NUMBER_LIMIT too aggressively may delete the "pre" snapshot of a previous update, making it impossible to roll back to a known-good state if a recent update fails.
Diagnostic Detail Required: Please specify if you are using a custom subvolume layout or a separate /home partition, as the home config requires independent tuning to prevent user data snapshots from consuming the same storage pool.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.