]> git.ipfire.org Git - thirdparty/snapper.git/commitdiff
- documented space aware cleanup 233/head
authorArvin Schnell <aschnell@suse.de>
Wed, 6 Apr 2016 14:21:48 +0000 (16:21 +0200)
committerArvin Schnell <aschnell@suse.de>
Wed, 6 Apr 2016 14:21:48 +0000 (16:21 +0200)
client/cleanup.cc
data/default-config
doc/snapper-configs.xml.in
doc/snapper.xml.in

index adf563bd7582c077dbeff02252df3f93898a8ddb..90164181e291431c69b830b0c0d3ed6ba778561b 100644 (file)
@@ -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;
 }
 
 
index cc4fcf2f492b4fcb1023c3e630de7640888ca65c..9d33f08aeb0d203a1885ae8cabd8756c0fcc54cd 100644 (file)
@@ -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
index 162c7d737279604b9ccab75dd707eb0ef394a468..12613908316ed27f55cddab29fc7c4e9bc33ce67 100644 (file)
        </listitem>
       </varlistentry>
 
+      <varlistentry>
+       <term><option>SPACE_LIMIT=<replaceable>float</replaceable></option></term>
+       <listitem>
+         <para>Limit for the fraction of the filesystems space the snapshots
+         should use.</para>
+         <para>Only supported for btrfs.</para>
+         <para>Default value is &quot;0.5&quot;.</para>
+         <para>New in version 0.3.0.</para>
+       </listitem>
+      </varlistentry>
+
       <varlistentry>
        <term><option>ALLOW_USERS=<replaceable>users</replaceable></option></term>
        <listitem>
       </varlistentry>
 
       <varlistentry>
-       <term><option>NUMBER_LIMIT=<replaceable>number</replaceable></option></term>
+       <term><option>NUMBER_LIMIT=<replaceable>number</replaceable> or
+       <replaceable>range</replaceable></option></term>
        <listitem>
          <para>Defines how many snapshots the number cleanup algorithm should
          keep. The youngest snapshots will be kept.</para>
       </varlistentry>
 
       <varlistentry>
-       <term><option>NUMBER_LIMIT_IMPORTANT=<replaceable>number</replaceable></option></term>
+       <term><option>NUMBER_LIMIT_IMPORTANT=<replaceable>number</replaceable> or
+       <replaceable>range</replaceable></option></term>
        <listitem>
          <para>Defines how many important snapshots the number cleanup
          algorithm should keep. Important snapshots have important=yes in the
       </varlistentry>
 
       <varlistentry>
-       <term><option>TIMELINE_LIMIT_HOURLY=<replaceable>number</replaceable></option></term>
+       <term><option>TIMELINE_LIMIT_HOURLY=<replaceable>number</replaceable> or
+       <replaceable>range</replaceable></option></term>
        <listitem>
          <para>Defines how many hourly snapshots the timeline cleanup
          algorithm should keep. An hourly snapshot is the first snapshot in an
       </varlistentry>
 
       <varlistentry>
-       <term><option>TIMELINE_LIMIT_DAILY=<replaceable>number</replaceable></option></term>
+       <term><option>TIMELINE_LIMIT_DAILY=<replaceable>number</replaceable> or
+       <replaceable>range</replaceable></option></term>
        <listitem>
          <para>Defines how many daily snapshots the timeline cleanup
          algorithm should keep. A daily snapshot is the first snapshot in a day. The
       </varlistentry>
 
       <varlistentry>
-       <term><option>TIMELINE_LIMIT_WEEKLY=<replaceable>number</replaceable></option></term>
+       <term><option>TIMELINE_LIMIT_WEEKLY=<replaceable>number</replaceable> or
+       <replaceable>range</replaceable></option></term>
        <listitem>
          <para>Defines how many weekly snapshots the timeline cleanup
          algorithm should keep. A weekly snapshot is the first snapshot in a week. The
       </varlistentry>
 
       <varlistentry>
-       <term><option>TIMELINE_LIMIT_MONTHLY=<replaceable>number</replaceable></option></term>
+       <term><option>TIMELINE_LIMIT_MONTHLY=<replaceable>number</replaceable> or
+       <replaceable>range</replaceable></option></term>
        <listitem>
          <para>Defines how many monthly snapshots the timeline cleanup
          algorithm should keep. A monthly snapshot is the first snapshot in a month. The
       </varlistentry>
 
       <varlistentry>
-       <term><option>TIMELINE_LIMIT_YEARLY=<replaceable>number</replaceable></option></term>
+       <term><option>TIMELINE_LIMIT_YEARLY=<replaceable>number</replaceable> or
+       <replaceable>range</replaceable></option></term>
        <listitem>
          <para>Defines how many yearly snapshots the timeline cleanup
          algorithm should keep. A yearly snapshot is the first snapshot in a year. The
index ce243fb697835e7e2cf5372be44dda8dda1bc1eb..62448eaaf4a30be8d99a9748da4e4fd3e85eb740 100644 (file)
        <glossentry>
          <glossterm>number</glossterm>
          <glossdef>
-           <para>Deletes old snapshots when a certain number of snapshots is reached.</para>
+           <para>Deletes old snapshots when a certain number of snapshots is
+           reached.</para>
          </glossdef>
        </glossentry>
        <glossentry>
          </glossdef>
        </glossentry>
       </glosslist>
+
+      <para>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:
+      <orderedlist>
+       <listitem>
+         <para>Delete snapshots above the max-value independent of the used
+         space.</para>
+       </listitem>
+       <listitem>
+         <para>Delete snapshots above the min-value until the limit for
+         the used space is reached.</para>
+       </listitem>
+      </orderedlist>
+      The limit for the used space can be configured via the SPACE_LIMIT
+      variable.
+      </para>
+
     </refsect2>
 
     <refsect2 id='filters'>