diff --git a/.config/btrbk/btrbk.conf b/.config/btrbk/btrbk.conf deleted file mode 100644 index 6dfb62fb..00000000 --- a/.config/btrbk/btrbk.conf +++ /dev/null @@ -1,40 +0,0 @@ - -# -# Example btrbk configuration file -# -# -# Please refer to the btrbk.conf(5) man-page for a complete -# description of all configuration options. -# For more examples, see README.md included with this package. -# -# btrbk.conf(5): -# README.md: -# -# Note that the options can be overridden per volume/subvolume/target -# in the corresponding sections. -# - - -# Enable transaction log -transaction_log /var/log/btrbk.log - -# Use sudo if btrbk or lsbtr is run by regular user -backend_local_user btrfs-progs-sudo - -# Enable stream buffer. Adding a buffer between the sending and -# receiving side is generally a good idea. -# NOTE: If enabled, make sure to install the "mbuffer" package! -stream_buffer 256m - -# Example retention policy: -snapshot_preserve_min 2d -snapshot_preserve 14d - -target_preserve_min no -target_preserve 20d 10w *m - - -# Simple setup -volume /home -snapshot_dir .snapshots -subvolume home \ No newline at end of file diff --git a/.config/btrbk/home_btrbk.conf b/.config/btrbk/home_btrbk.conf new file mode 100644 index 00000000..8bba93b5 --- /dev/null +++ b/.config/btrbk/home_btrbk.conf @@ -0,0 +1,29 @@ +# +# btrbk configuration file for /home +# + +# Enable transaction log +transaction_log /var/log/home_btrbk.log + +# Use sudo if btrbk or lsbtr is run by regular user +backend_local_user btrfs-progs-sudo + +# Enable stream buffer +stream_buffer 256m + +# Retention policy +snapshot_preserve_min 2d +snapshot_preserve 14d + +target_preserve_min no +target_preserve 20d 10w *m + +snapshot_dir .snapshots + +# Local snapshots +volume /home + subvolume tstarr + # Always create snapshot, even if targets are unreachable + snapshot_create always + # Need a btrfs server before this will work + #target /mnt/engi/backup/kestrel_backups \ No newline at end of file diff --git a/.config/btrbk/root_btrbk.conf b/.config/btrbk/root_btrbk.conf new file mode 100644 index 00000000..55fa0c38 --- /dev/null +++ b/.config/btrbk/root_btrbk.conf @@ -0,0 +1,26 @@ +# +# btrbk configuration file for root +# + +# Enable transaction log +transaction_log /var/log/root_btrbk.log + +# Use sudo if btrbk or lsbtr is run by regular user +backend_local_user btrfs-progs-sudo + +# Enable stream buffer +stream_buffer 256m + +# Retention policy +snapshot_preserve_min 2d +snapshot_preserve 14d + +target_preserve_min no +target_preserve 20d 10w *m + +snapshot_dir .snapshots + +# Local snapshots +volume / + subvolume . + snapshot_name root diff --git a/.local/bin/update b/.local/bin/update index 0bcc1138..5546efad 100755 --- a/.local/bin/update +++ b/.local/bin/update @@ -7,7 +7,7 @@ echo -e "Starting update for Fedora..." cd ~/.dotfiles/provision # Install ansible and run playbook -ansible-playbook setup.yml -i hosts --ask-become-pass --tags "$1" +ansible-playbook setup.yml -i hosts --ask-become-pass --tags "$1" --skip-tags "once" # Return to where you were cd - diff --git a/.stow-local-ignore b/.stow-local-ignore index 2490db0d..67f1d1bd 100644 --- a/.stow-local-ignore +++ b/.stow-local-ignore @@ -2,3 +2,4 @@ readme.md .gitignore .git provision +additional-setup.md diff --git a/additional-setup.md b/additional-setup.md index c8bb68d6..303c2bc7 100644 --- a/additional-setup.md +++ b/additional-setup.md @@ -36,4 +36,24 @@ Wireguard is nice for a home vpn. sudo nmcli connection import type wireguard file /etc/wireguard/your-wg-file.conf ``` -The vpn can be enable/disabled through gnome. \ No newline at end of file +The vpn can be enable/disabled through gnome. + +## btrbk + +[btrbk](https://github.com/digint/btrbk) is used to create (currently only local) snapshots of the root and user volumes. + +```bash +sudo btrbk -c ~/.config/btrbk/home_btrbk.conf -v run # creates user backups and snapshots +sudo btrbk -c ~/.config/btrbk/root_btrbk.conf -v run # creates root snapshots +``` + +## Automount network drive with fstab + +Fstab can be mounted when the network drive is accessed. This is done the "engi" home server. + +```bash +sudo mkdir -p /mnt/engi + +# Add following line to fstab +///engi /mnt/engi cifs uid=1000,credentials=/home/tstarr/.smb,iocharset=utf8,noauto,x-systemd.automount 0 0 +``` \ No newline at end of file diff --git a/provision/tasks/system/configs.yml b/provision/tasks/system/configs.yml index 00ee406e..ffe7ba2a 100644 --- a/provision/tasks/system/configs.yml +++ b/provision/tasks/system/configs.yml @@ -24,3 +24,20 @@ state: present flatpakrepo_url: https://flathub.org/repo/flathub.flatpakrepo become: true + +- name: Create btrbk snapshot directories + tags: ["once"] + block: + - file: + path: /.snapshots + state: directory + owner: root + group: root + mode: 0775 + - file: + path: /home/.snapshots + state: directory + owner: root + group: root + mode: 0775 + become: true \ No newline at end of file diff --git a/readme.md b/readme.md index 8943f838..4dbdbd8b 100644 --- a/readme.md +++ b/readme.md @@ -32,4 +32,4 @@ update {tags} # valid tags: configs, updates, packages, services, once ## TODO -- add https://github.com/digint/btrbk \ No newline at end of file +- make homesever use btrfs and fix "target" for home backups \ No newline at end of file