Ubuntu zsys: Difference between revisions

From Lolly's Wiki
Jump to navigationJump to search
m (Text replacement - "<source " to "<syntaxhighlight ")
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
[[category:Ubuntu]]
[[category:Ubuntu]]
==Cconfigure garbage collection==
==Configure garbage collection==
<syntaxhighlight lang=yaml>
<syntaxhighlight lang=yaml>
cat > /etc/zsys.conf <<EOF
cat > /etc/zsys.conf <<EOF
Line 57: Line 57:
EOF
EOF
systemctl restart zsysd.service
systemctl restart zsysd.service
zsysctl service gc
zsysctl -vvv service gc
update-grub
update-grub
</syntaxhighlight>
== Current machine isn't Zsys, nothing to create ==
<syntaxhighlight lang=bash>
# zfs set com.ubuntu.zsys:bootfs=yes $(df --output=source -t zfs / | tail -1)
</syntaxhighlight>
<syntaxhighlight lang=bash>
# zfs list -o name,com.ubuntu.zsys:bootfs $(df --output=source -t zfs / | tail -1)
NAME                      COM.UBUNTU.ZSYS:BOOTFS
rpool/ROOT/ubuntu_82yzok  yes
</syntaxhighlight>
<syntaxhighlight lang=bash>
# systemctl restart zsys*
</syntaxhighlight>
<syntaxhighlight lang=bash>
# zsysctl list
ID                        ZSys  Last Used
--                        ----  ---------
rpool/ROOT/ubuntu_82yzok  true  current
# zsysctl save --system
ZSys is adding automatic system snapshot to GRUB menu
</syntaxhighlight>
</syntaxhighlight>

Latest revision as of 12:43, 22 June 2023

Configure garbage collection

cat > /etc/zsys.conf <<EOF
history:
  # Keep at least n history entry per unit of time if enough of them are present
  # The order condition the bucket start and end dates (from most recent to oldest)

  # We also keep all previous state saves for the previous day.
  # gcstartafter: 1 (GC start after a whole day).
  gcstartafter: 1 

  # Minimum number of recent states to keep.
  keeplast: 7

  #    - name:             Abitrary name of the bucket
  #      buckets:          Number of buckets over the interval
  #      bucketlength:     Length of each bucket in days
  #      samplesperbucket: Number of datasets to keep in each bucket
  gcrules:
    - name: PreviousDay
      buckets: 1
      bucketlength: 1
      samplesperbucket: 3
      #
      # For the previous Day (after on full day of retention of all
      # snapshots due to gcstartafter: 1), the rule PreviousDay
      # defines one bucket (buckets: 1) of size 1 day (bucketlength: 1),
      # where we keep 3 states. So basically, we keep 3 states on the
      # previous full day.
      #
    - name: PreviousWeek
      buckets: 5
      bucketlength: 1
      samplesperbucket: 1
      #
      # For the 5 days before (buckets: 5 of size 1 day (bucketlength: 1)),
      # we keep one state (samplesperbucket: 1).
      # It means thus that we keep one state per day for each of those 5 days.
      #
    - name: PreviousMonth
      buckets: 4
      bucketlength: 7
      samplesperbucket: 1
      #
      # We divide the previous month, in 4 buckets (buckets: 4) of
      # 7 days each (bucketlength: 7) and keep one state for each
      # (samplesperbucket: 1).
      # In English, this means that we try to keep one state save
      # per week over the previous month.
      #
general:
  # Minimal free space required before taking a snapshot
  minfreepoolspace: 20
  # Daemon timeout in seconds
  timeout: 60
EOF
systemctl restart zsysd.service
zsysctl -vvv service gc
update-grub

Current machine isn't Zsys, nothing to create

# zfs set com.ubuntu.zsys:bootfs=yes $(df --output=source -t zfs / | tail -1)
# zfs list -o name,com.ubuntu.zsys:bootfs $(df --output=source -t zfs / | tail -1)
NAME                      COM.UBUNTU.ZSYS:BOOTFS
rpool/ROOT/ubuntu_82yzok  yes
# systemctl restart zsys*
# zsysctl list
ID                        ZSys  Last Used
--                        ----  ---------
rpool/ROOT/ubuntu_82yzok  true  current

# zsysctl save --system
ZSys is adding automatic system snapshot to GRUB menu