From 8e33cea1fd2882718efd305b796402969603b37b Mon Sep 17 00:00:00 2001 From: "Tobias J. Endres" Date: Sat, 15 Feb 2025 04:19:18 +0100 Subject: [PATCH] .gitignore and snapper configs --- .gitignore | 128 +++++++++++++++++++++++++++++++ snap-pac.ini | 54 +++++++++++++ snapper/config-templates/snapper | 63 +++++++++++++++ snapper/configs/homebackup | 64 ++++++++++++++++ snapper/configs/systembackup | 64 ++++++++++++++++ 5 files changed, 373 insertions(+) create mode 100644 .gitignore create mode 100644 snap-pac.ini create mode 100644 snapper/config-templates/snapper create mode 100644 snapper/configs/homebackup create mode 100644 snapper/configs/systembackup diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..76e8d2b --- /dev/null +++ b/.gitignore @@ -0,0 +1,128 @@ +# Ignore sensitive files +shadow +gshadow +sudoers +ssh/ssh_host_*_key + +# Ignore system-specific files +fstab +mtab +adjtime +machine-id + +# Ignore temporary or cache files +*.cache +*.tmp +*.swp + +# Ignore log files +*.log + +# Ignore directories with dynamic or system-specific data +/network/ +/init.d/ +/rc.d/ +/udev/ +/default/ +/security/ + +# Ignore files related to package management +/apt/ +/dpkg/ + +# Ignore files related to specific services +/postfix/ +/samba/ +/cups/ + +# Ignore files related to user management +/passwd +/group + +# Ignore files related to time configuration +/localtime +/timezone + +# Ignore files related to hardware configuration +/modprobe.d/ +/modules-load.d/ + +# Ignore files related to boot configuration +/grub.d/ +/initramfs-tools/ + +# Ignore files related to X11 configuration +/X11/ + +# Ignore files related to systemd +/systemd/ +/sysctl.d/ + +# Ignore files related to specific applications +/mysql/ +/php/ +/nginx/ +/apache2/ + +# Ignore files related to SSL/TLS +/ssl/ +/pki/ + +# Ignore files related to cron jobs +/cron.d/ +/cron.daily/ +/cron.hourly/ +/cron.monthly/ +/cron.weekly/ + +# Ignore files related to mail configuration +/mail/ +/postfix/ + +# Ignore files related to printer configuration +/cups/ +/ppd/ + +# Ignore files related to network configuration +/network/ +/netplan/ + +# Ignore files related to DNS configuration +/resolv.conf +/hosts + +# Ignore files related to locale configuration +/locale.conf +/locale.gen + +# Ignore files related to environment variables +/environment +/profile + +# Ignore files related to specific hardware +/bluetooth/ +/modprobe.d/ + +# Ignore files related to specific services +/avahi/ +/dbus-1/ +/systemd/ + +# Ignore files related to specific applications +/opt/ +/snap/ +/flatpak/ + +# Ignore files related to specific users +/skel/ +/subuid +/subgid + +# Ignore files related to specific hardware +/bluetooth/ +/modprobe.d/ + +# Ignore files related to specific services +/avahi/ +/dbus-1/ +/systemd/ diff --git a/snap-pac.ini b/snap-pac.ini new file mode 100644 index 0000000..20db18f --- /dev/null +++ b/snap-pac.ini @@ -0,0 +1,54 @@ +# snap-pac example configuration file +# see snap-pac(8) for more details + +# Each section corresponds with a snapper configuration. Add additional sections to add +# other configurations to be snapshotted. By default, only the root configuration is snapshotted. +# Create a section named [DEFAULT] to have a setting apply for all snapper configurations + +## Uncomment to set parameters for snapper configuration named root +[systembackup] + +## How many characters to limit the description for snapper. +## Default is 72 +#desc_limit = 72 + +## Whether or not to take snapshots of this snapper configuration +## Default is True for root configuration and False for all other configurations +snapshot = True + +## What snapper cleanup algorithm to use +## Default is number +#cleanup_algorithm = number + +## Pre snapshot description. +## Default is the pacman command that triggered the hook +#pre_description = pacman pre snapshot root filesystem + +## Post snapshot description. +## Default is the list of packages involved in the pacman transaction +#post_description = pacman post snapshot root filesystem + +## Uncomment to add "important=yes" to userdata for snapshots referring to these packages +## Default is [] +important_packages = ["linux", "linux-lts"] + +## Uncomment to add "important=yes" to userdata for snapshots that were created with the following commands +## Default is [] +important_commands = ["pacman -Syu"] + +## Add custom userdata. Each key-value pair should be an item in the list +## Default is [] +#userdata = ["key=value","foo=bar"] + +## Example for another snapper configuration named "home" +[homebackup] +## Default is False +snapshot = True + +## Pre snapshot description. +## Default is the pacman command that triggered the hook +#pre_description = pacman pre snapshot root filesystem + +## Post snapshot description. +## Default is the list of packages involved in the pacman transaction +#post_description = pacman post snapshot root filesystem diff --git a/snapper/config-templates/snapper b/snapper/config-templates/snapper new file mode 100644 index 0000000..0709c28 --- /dev/null +++ b/snapper/config-templates/snapper @@ -0,0 +1,63 @@ + +# subvolume to snapshot +SUBVOLUME="/" + +# filesystem type +FSTYPE="btrfs" + + +# btrfs qgroup for space aware cleanup algorithms +QGROUP="" + + +# fraction or absolute size of the filesystems space the snapshots may use +SPACE_LIMIT="0.5" + +# fraction or absolute size of the filesystems space that should be free +FREE_LIMIT="0.2" + + +# users and groups allowed to work with config +ALLOW_USERS="" +ALLOW_GROUPS="" + +# sync users and groups from ALLOW_USERS and ALLOW_GROUPS to .snapshots +# directory +SYNC_ACL="no" + + +# start comparing pre- and post-snapshot in background after creating +# post-snapshot +BACKGROUND_COMPARISON="yes" + + +# run daily number cleanup +NUMBER_CLEANUP="yes" + +# limit for number cleanup +NUMBER_MIN_AGE="1800" +NUMBER_LIMIT="10" +NUMBER_LIMIT_IMPORTANT="5" + + +# create hourly snapshots +TIMELINE_CREATE="no" + +# cleanup hourly snapshots after some time +TIMELINE_CLEANUP="yes" + +# limits for timeline cleanup +TIMELINE_MIN_AGE="1800" +TIMELINE_LIMIT_HOURLY="5" +TIMELINE_LIMIT_DAILY="7" +TIMELINE_LIMIT_WEEKLY="0" +TIMELINE_LIMIT_MONTHLY="0" +TIMELINE_LIMIT_YEARLY="0" + + +# cleanup empty pre-post-pairs +EMPTY_PRE_POST_CLEANUP="yes" + +# limits for empty pre-post-pair cleanup +EMPTY_PRE_POST_MIN_AGE="1800" + diff --git a/snapper/configs/homebackup b/snapper/configs/homebackup new file mode 100644 index 0000000..2f9cb4f --- /dev/null +++ b/snapper/configs/homebackup @@ -0,0 +1,64 @@ + +# subvolume to snapshot +SUBVOLUME="/home" + +# filesystem type +FSTYPE="btrfs" + + +# btrfs qgroup for space aware cleanup algorithms +QGROUP="" + + +# fraction or absolute size of the filesystems space the snapshots may use +SPACE_LIMIT="0.5" + +# fraction or absolute size of the filesystems space that should be free +FREE_LIMIT="0.2" + + +# users and groups allowed to work with config +ALLOW_USERS="" +ALLOW_GROUPS="" + +# sync users and groups from ALLOW_USERS and ALLOW_GROUPS to .snapshots +# directory +SYNC_ACL="no" + + +# start comparing pre- and post-snapshot in background after creating +# post-snapshot +BACKGROUND_COMPARISON="yes" + + +# run daily number cleanup +NUMBER_CLEANUP="yes" + +# limit for number cleanup +NUMBER_MIN_AGE="3600" +NUMBER_LIMIT="15" +NUMBER_LIMIT_IMPORTANT="10" + + +# create hourly snapshots +TIMELINE_CREATE="yes" + +# cleanup hourly snapshots after some time +TIMELINE_CLEANUP="yes" + +# limits for timeline cleanup +TIMELINE_MIN_AGE="3600" +TIMELINE_LIMIT_HOURLY="12" +TIMELINE_LIMIT_DAILY="12" +TIMELINE_LIMIT_WEEKLY="1" +TIMELINE_LIMIT_MONTHLY="1" +TIMELINE_LIMIT_QUARTERLY="0" +TIMELINE_LIMIT_YEARLY="0" + + +# cleanup empty pre-post-pairs +EMPTY_PRE_POST_CLEANUP="yes" + +# limits for empty pre-post-pair cleanup +EMPTY_PRE_POST_MIN_AGE="3600" + diff --git a/snapper/configs/systembackup b/snapper/configs/systembackup new file mode 100644 index 0000000..54cd954 --- /dev/null +++ b/snapper/configs/systembackup @@ -0,0 +1,64 @@ + +# subvolume to snapshot +SUBVOLUME="/" + +# filesystem type +FSTYPE="btrfs" + + +# btrfs qgroup for space aware cleanup algorithms +QGROUP="" + + +# fraction or absolute size of the filesystems space the snapshots may use +SPACE_LIMIT="0.5" + +# fraction or absolute size of the filesystems space that should be free +FREE_LIMIT="0.2" + + +# users and groups allowed to work with config +ALLOW_USERS="" +ALLOW_GROUPS="" + +# sync users and groups from ALLOW_USERS and ALLOW_GROUPS to .snapshots +# directory +SYNC_ACL="no" + + +# start comparing pre- and post-snapshot in background after creating +# post-snapshot +BACKGROUND_COMPARISON="yes" + + +# run daily number cleanup +NUMBER_CLEANUP="yes" + +# limit for number cleanup +NUMBER_MIN_AGE="3600" +NUMBER_LIMIT="15" +NUMBER_LIMIT_IMPORTANT="10" + + +# create hourly snapshots +TIMELINE_CREATE="yes" + +# cleanup hourly snapshots after some time +TIMELINE_CLEANUP="yes" + +# limits for timeline cleanup +TIMELINE_MIN_AGE="3600" +TIMELINE_LIMIT_HOURLY="5" +TIMELINE_LIMIT_DAILY="2" +TIMELINE_LIMIT_WEEKLY="1" +TIMELINE_LIMIT_MONTHLY="1" +TIMELINE_LIMIT_QUARTERLY="0" +TIMELINE_LIMIT_YEARLY="1" + + +# cleanup empty pre-post-pairs +EMPTY_PRE_POST_CLEANUP="yes" + +# limits for empty pre-post-pair cleanup +EMPTY_PRE_POST_MIN_AGE="3600" +