updates for btrbk

This commit is contained in:
Tyler Starr 2022-11-23 23:38:18 -08:00
parent a40487c018
commit 2e5021e0da
8 changed files with 96 additions and 43 deletions

View File

@ -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): <https://digint.ch/btrbk/doc/btrbk.conf.5.html>
# README.md: <https://digint.ch/btrbk/doc/readme.html>
#
# 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

View File

@ -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

View File

@ -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

View File

@ -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 -

View File

@ -2,3 +2,4 @@ readme.md
.gitignore
.git
provision
additional-setup.md

View File

@ -37,3 +37,23 @@ sudo nmcli connection import type wireguard file /etc/wireguard/your-wg-file.con
```
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
//<server-ip>/engi /mnt/engi cifs uid=1000,credentials=/home/tstarr/.smb,iocharset=utf8,noauto,x-systemd.automount 0 0
```

View File

@ -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

View File

@ -32,4 +32,4 @@ update {tags} # valid tags: configs, updates, packages, services, once
## TODO
- add https://github.com/digint/btrbk
- make homesever use btrfs and fix "target" for home backups