From 0a0fa9b6ddd572b47062f2a5a522fa43ea956940 Mon Sep 17 00:00:00 2001 From: Arvin Schnell Date: Wed, 6 Apr 2016 16:21:48 +0200 Subject: [PATCH] - documented space aware cleanup --- client/cleanup.cc | 10 +++++----- data/default-config | 2 +- doc/snapper-configs.xml.in | 32 +++++++++++++++++++++++++------- doc/snapper.xml.in | 23 ++++++++++++++++++++++- 4 files changed, 53 insertions(+), 14 deletions(-) diff --git a/client/cleanup.cc b/client/cleanup.cc index adf563bd..90164181 100644 --- a/client/cleanup.cc +++ b/client/cleanup.cc @@ -40,16 +40,16 @@ struct Parameters friend ostream& operator<<(ostream& s, const Parameters& parameters); time_t min_age; - double quota_limit; + double space_limit; }; Parameters::Parameters(DBus::Connection& conn, const string& config_name) - : min_age(1800), quota_limit(0.5) + : min_age(1800), space_limit(0.5) { XConfigInfo ci = command_get_xconfig(conn, config_name); - ci.read("QUOTA_LIMIT", quota_limit); + ci.read("SPACE_LIMIT", space_limit); } @@ -57,7 +57,7 @@ ostream& operator<<(ostream& s, const Parameters& parameters) { return s << "min-age:" << parameters.min_age << endl - << "quota-limit:" << parameters.quota_limit; + << "space-limit:" << parameters.space_limit; } @@ -205,7 +205,7 @@ Cleaner::is_quota_satisfied() const { XQuotaData quota_data = command_query_quota(conn, config_name); - return quota_data.used < parameters.quota_limit * quota_data.size; + return quota_data.used < parameters.space_limit * quota_data.size; } diff --git a/data/default-config b/data/default-config index cc4fcf2f..9d33f08a 100644 --- a/data/default-config +++ b/data/default-config @@ -11,7 +11,7 @@ QGROUP="" # fraction of the filesystems space the snapshots may use -QUOTA_LIMIT="0.5" +SPACE_LIMIT="0.5" # users and groups allowed to work with config diff --git a/doc/snapper-configs.xml.in b/doc/snapper-configs.xml.in index 162c7d73..12613908 100644 --- a/doc/snapper-configs.xml.in +++ b/doc/snapper-configs.xml.in @@ -60,6 +60,17 @@ + + + + Limit for the fraction of the filesystems space the snapshots + should use. + Only supported for btrfs. + Default value is "0.5". + New in version 0.3.0. + + + @@ -126,7 +137,8 @@ - + Defines how many snapshots the number cleanup algorithm should keep. The youngest snapshots will be kept. @@ -135,7 +147,8 @@ - + Defines how many important snapshots the number cleanup algorithm should keep. Important snapshots have important=yes in the @@ -177,7 +190,8 @@ - + Defines how many hourly snapshots the timeline cleanup algorithm should keep. An hourly snapshot is the first snapshot in an @@ -187,7 +201,8 @@ - + Defines how many daily snapshots the timeline cleanup algorithm should keep. A daily snapshot is the first snapshot in a day. The @@ -197,7 +212,8 @@ - + Defines how many weekly snapshots the timeline cleanup algorithm should keep. A weekly snapshot is the first snapshot in a week. The @@ -208,7 +224,8 @@ - + Defines how many monthly snapshots the timeline cleanup algorithm should keep. A monthly snapshot is the first snapshot in a month. The @@ -218,7 +235,8 @@ - + Defines how many yearly snapshots the timeline cleanup algorithm should keep. A yearly snapshot is the first snapshot in a year. The diff --git a/doc/snapper.xml.in b/doc/snapper.xml.in index ce243fb6..62448eaa 100644 --- a/doc/snapper.xml.in +++ b/doc/snapper.xml.in @@ -117,7 +117,8 @@ number - Deletes old snapshots when a certain number of snapshots is reached. + Deletes old snapshots when a certain number of snapshots is + reached. @@ -134,6 +135,26 @@ + + The number and timeline cleanup algorithm can also try to keep the + space used by snapshots below a limit. For that quota must be setup, see + command setup-quota, and the LIMIT variables in the config file must + have ranges (min- and max-value). The algorithms will then make two + passes: + + + Delete snapshots above the max-value independent of the used + space. + + + Delete snapshots above the min-value until the limit for + the used space is reached. + + + The limit for the used space can be configured via the SPACE_LIMIT + variable. + + -- 2.47.3