catarina: backups and snapshots #1, fs description #3

This commit is contained in:
L-Nafaryus 2024-04-03 22:24:18 +05:00
parent 229e3d4017
commit c162b262ab
Signed by: L-Nafaryus
GPG Key ID: 582F8B0866B294A1
3 changed files with 82 additions and 14 deletions

View File

@ -0,0 +1,31 @@
# catarina
## Partitions
```sh
mkfs.fat -F 32 /dev/sda1
fatlabel /dev/sda1 boot
mkfs.btrfs /dev/sda2
btrfs filesystem label /dev/sda2 nixos
mkdir -p /mnt
mount /dev/sda2 /mnt
btrfs subvolume create /mnt/root
btrfs subvolume create /mnt/nix
btrfs subvolume create /mnt/home
btrfs subvolume create /mnt/persist
btrfs subvolume create /mnt/swap
umount /mnt
mount -o compress=zstd,subvol=root /dev/sda2 /mnt
mkdir /mnt/{boot,nix,home,persist,swap}
mount /dev/sda1 /mnt/boot
mount -o compress=zstd,noatime,subvol=nix /dev/sda2 /mnt/nix
mount -o compress=zstd,subvol=home /dev/sda2 /mnt/home
mount -o compress=zstd,subvol=persist /dev/sda2 /mnt/persist
mount -o noatime,subvol=swap /dev/sda2 /mnt/swap
btrfs filesystem mkswapfile --size 16g --uuid clear /swap/swapfile
mkdir -p /media/{storage,btrbk-backups,btrbk-snapshots}
```

View File

@ -161,22 +161,46 @@ rec {
services.spoofdpi.enable = true; services.spoofdpi.enable = true;
services.qbittorrent-nox = { services.btrfs.autoScrub = {
enable = false; enable = true;
webuiPort = 8085; interval = "monthly";
openFirewall = true; fileSystems = [ "/" ];
}; };
#services.btrbk = { services.btrbk = {
# instances."catarina" = { instances."catarina" = {
# onCalendar = "weekly"; onCalendar = "daily";
# settings = {
# volume."/" = { settings = {
# snapshot_preserve_min = "2d";
# }; snapshot_preserve = "14d";
# }; snapshot_dir = "/media/btrbk-snapshots";
# }; target_preserve_min = "no";
#}; target_preserve = "14d 8w *m";
volume."/" = {
target = "/media/btrbk-backups";
subvolume = {
"var/lib/gitea" = {};
"var/lib/postgresql" = {};
"var/lib/postfix" = {};
"var/vmail" = {};
};
};
};
};
};
services.transmission = {
enable = true;
openRPCPort = true;
settings = {
rpc-bind-address = "0.0.0.0";
rpc-whitelist = "127.0.0.1,192.168.156.101";
download-dir = "/media/storage/downloads";
incomplete-dir = "/media/storage/downloads/incomplete";
};
};
# Packages # Packages
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
@ -186,6 +210,7 @@ rec {
sshfs sshfs
exfat exfat
btrfs-progs btrfs-progs
btrbk
lm_sensors lm_sensors

View File

@ -93,6 +93,18 @@
fsType = "btrfs"; fsType = "btrfs";
options = [ "subvol=swap" "noatime" ]; options = [ "subvol=swap" "noatime" ];
}; };
"/media/storage" = {
device = "/dev/disk/by-label/storage";
fsType = "btrfs";
options = [ "subvol=storage" "nofail" "compress=zstd" ];
};
"/media/btrbk-backups" = {
device = "/dev/disk/by-label/storage";
fsType = "btrfs";
options = [ "subvol=btrbk-backups" "nofail" "compress=zstd" ];
};
}; };
swapDevices = [ swapDevices = [