hosts: add btrfs scrub and snapper for all

This commit is contained in:
Kabbone 2023-01-13 17:21:18 +01:00
parent 27c900063c
commit 75c20bc6f0
Signed by: Kabbone
SSH Key Fingerprint: SHA256:A5zPB5I6u5V78V51c362BBdCwhDhfDUVbt7NfKdjWBY
5 changed files with 231 additions and 9 deletions

View File

@ -143,15 +143,6 @@
# com.obsproject.Studio
# com.parsecgaming.parsec
# com.usebottles.bottles
snapper.configs = {
home = {
subvolume = "/home";
extraConfig = ''
TIMELINE_CREATE=yes
TIMELINE_CLEANUP=yes
'';
};
};
gvfs.enable = true;
};

View File

@ -24,6 +24,29 @@
boot.tmpOnTmpfs = true;
zramSwap.enable = true;
services.btrfs.autoScrub = {
enable = true;
interval = "monthly";
fileSystems = [
"/"
];
};
services.snapper.configs = {
home = {
subvolume = "/home";
extraConfig = ''
TIMELINE_CREATE=yes
TIMELINE_CLEANUP=yes
TIMELINE_LIMIT_HOURLY="5"
TIMELINE_LIMIT_DAILY="5"
TIMELINE_LIMIT_WEEKLY="2"
TIMELINE_LIMIT_MONTHLY="2"
TIMELINE_LIMIT_YEARLY="0"
'';
};
};
fileSystems."/" =
{ device = "/dev/disk/by-label/NIXROOT";
fsType = "btrfs";

View File

@ -33,6 +33,29 @@
};
};
services.btrfs.autoScrub = {
enable = true;
interval = "monthly";
fileSystems = [
"/"
];
};
services.snapper.configs = {
home = {
subvolume = "/home";
extraConfig = ''
TIMELINE_CREATE=yes
TIMELINE_CLEANUP=yes
TIMELINE_LIMIT_HOURLY="5"
TIMELINE_LIMIT_DAILY="5"
TIMELINE_LIMIT_WEEKLY="2"
TIMELINE_LIMIT_MONTHLY="2"
TIMELINE_LIMIT_YEARLY="0"
'';
};
};
fileSystems."/" =
{ device = "/dev/mapper/root";
fsType = "btrfs";

View File

@ -38,6 +38,115 @@
boot.tmpOnTmpfs = true;
zramSwap.enable = true;
services.btrfs.autoScrub = {
enable = true;
interval = "monthly";
fileSystems = [
"/"
"/mnt/Pluto"
"/mnt/Mars"
];
};
services.snapper.configs = {
home = {
subvolume = "/home";
extraConfig = ''
TIMELINE_CREATE=yes
TIMELINE_CLEANUP=yes
TIMELINE_LIMIT_HOURLY="5"
TIMELINE_LIMIT_DAILY="5"
TIMELINE_LIMIT_WEEKLY="2"
TIMELINE_LIMIT_MONTHLY="2"
TIMELINE_LIMIT_YEARLY="0"
'';
};
mars_home = {
subvolume = "/mnt/Mars/Home";
extraConfig = ''
TIMELINE_CREATE=yes
TIMELINE_CLEANUP=yes
TIMELINE_LIMIT_HOURLY="5"
TIMELINE_LIMIT_DAILY="5"
TIMELINE_LIMIT_WEEKLY="2"
TIMELINE_LIMIT_MONTHLY="2"
TIMELINE_LIMIT_YEARLY="0"
'';
};
pluto_backups = {
subvolume = "/mnt/Pluto/Backups";
extraConfig = ''
TIMELINE_CREATE=yes
TIMELINE_CLEANUP=yes
TIMELINE_LIMIT_HOURLY="3"
TIMELINE_LIMIT_DAILY="3"
TIMELINE_LIMIT_WEEKLY="2"
TIMELINE_LIMIT_MONTHLY="2"
TIMELINE_LIMIT_YEARLY="0"
'';
};
pluto_games = {
subvolume = "/mnt/Pluto/Games";
extraConfig = ''
TIMELINE_CREATE=yes
TIMELINE_CLEANUP=yes
TIMELINE_LIMIT_HOURLY="5"
TIMELINE_LIMIT_DAILY="5"
TIMELINE_LIMIT_WEEKLY="2"
TIMELINE_LIMIT_MONTHLY="2"
TIMELINE_LIMIT_YEARLY="0"
'';
};
pluto_it = {
subvolume = "/mnt/Pluto/IT";
extraConfig = ''
TIMELINE_CREATE=yes
TIMELINE_CLEANUP=yes
TIMELINE_LIMIT_HOURLY="5"
TIMELINE_LIMIT_DAILY="5"hm
TIMELINE_LIMIT_WEEKLY="2"
TIMELINE_LIMIT_MONTHLY="2"
TIMELINE_LIMIT_YEARLY="0"
'';
};
pluto_media = {
subvolume = "/mnt/Pluto/Media";
extraConfig = ''
TIMELINE_CREATE=yes
TIMELINE_CLEANUP=yes
TIMELINE_LIMIT_HOURLY="5"
TIMELINE_LIMIT_DAILY="5"
TIMELINE_LIMIT_WEEKLY="2"
TIMELINE_LIMIT_MONTHLY="2"
TIMELINE_LIMIT_YEARLY="0"
'';
};
pluto_pictures = {
subvolume = "/mnt/Pluto/Pictures";
extraConfig = ''
TIMELINE_CREATE=yes
TIMELINE_CLEANUP=yes
TIMELINE_LIMIT_HOURLY="5"
TIMELINE_LIMIT_DAILY="5"
TIMELINE_LIMIT_WEEKLY="2"
TIMELINE_LIMIT_MONTHLY="2"
TIMELINE_LIMIT_YEARLY="0"
'';
};
pluto_rest = {
subvolume = "/mnt/Pluto/Rest";
extraConfig = ''
TIMELINE_CREATE=yes
TIMELINE_CLEANUP=yes
TIMELINE_LIMIT_HOURLY="5"
TIMELINE_LIMIT_DAILY="5"
TIMELINE_LIMIT_WEEKLY="2"
TIMELINE_LIMIT_MONTHLY="2"
TIMELINE_LIMIT_YEARLY="0"
'';
};
};
fileSystems."/" =
{ device = "/dev/disk/by-label/NIXROOT";
fsType = "btrfs";
@ -74,12 +183,60 @@
options = [ "compress=zstd,space_cache=v2,noatime,subvol=@" ];
};
fileSystems."/mnt/Pluto/.snapshots" =
{ device = "/dev/disk/by-label/NAS-RAID";
fsType = "btrfs";
options = [ "compress=zstd,space_cache=v2,noatime,subvol=@snapshots" ];
};
fileSystems."/mnt/Pluto/Backups/.snapshots" =
{ device = "/dev/disk/by-label/NAS-RAID";
fsType = "btrfs";
options = [ "compress=zstd,space_cache=v2,noatime,subvol=@snapshots/Backups" ];
};
fileSystems."/mnt/Pluto/Games/.snapshots" =
{ device = "/dev/disk/by-label/NAS-RAID";
fsType = "btrfs";
options = [ "compress=zstd,space_cache=v2,noatime,subvol=@snapshots/Games" ];
};
fileSystems."/mnt/Pluto/IT/.snapshots" =
{ device = "/dev/disk/by-label/NAS-RAID";
fsType = "btrfs";
options = [ "compress=zstd,space_cache=v2,noatime,subvol=@snapshots/IT" ];
};
fileSystems."/mnt/Pluto/Media/.snapshots" =
{ device = "/dev/disk/by-label/NAS-RAID";
fsType = "btrfs";
options = [ "compress=zstd,space_cache=v2,noatime,subvol=@snapshots/Media" ];
};
fileSystems."/mnt/Pluto/Pictures/.snapshots" =
{ device = "/dev/disk/by-label/NAS-RAID";
fsType = "btrfs";
options = [ "compress=zstd,space_cache=v2,noatime,subvol=@snapshots/Pictures" ];
};
fileSystems."/mnt/Pluto/Rest/.snapshots" =
{ device = "/dev/disk/by-label/NAS-RAID";
fsType = "btrfs";
options = [ "compress=zstd,space_cache=v2,noatime,subvol=@snapshots/Rest" ];
};
fileSystems."/mnt/Mars" =
{ device = "/dev/disk/by-label/NIXROOT";
fsType = "btrfs";
options = [ "compress=zstd,space_cache=v2,ssd,noatime,subvol=@nas,discard=async" ];
};
fileSystems."/mnt/Mars/Home/.snapshots" =
{ device = "/dev/disk/by-label/NIXROOT";
fsType = "btrfs";
options = [ "compress=zstd,space_cache=v2,ssd,noatime,subvol=@snapshots/mars/Home,discard=async" ];
};
fileSystems."/boot" =
{ device = "/dev/disk/by-label/NIXBOOT";
fsType = "vfat";
@ -95,6 +252,11 @@
options = [ "bind" ];
};
fileSystems."/export/Nix" =
{ device = "/nix";
options = [ "bind" ];
};
swapDevices = [ ];

View File

@ -24,6 +24,29 @@
boot.tmpOnTmpfs = true;
zramSwap.enable = true;
services.btrfs.autoScrub = {
enable = true;
interval = "monthly";
fileSystems = [
"/"
];
};
services.snapper.configs = {
home = {
subvolume = "/home";
extraConfig = ''
TIMELINE_CREATE=yes
TIMELINE_CLEANUP=yes
TIMELINE_LIMIT_HOURLY="5"
TIMELINE_LIMIT_DAILY="5"
TIMELINE_LIMIT_WEEKLY="2"
TIMELINE_LIMIT_MONTHLY="2"
TIMELINE_LIMIT_YEARLY="0"
'';
};
};
fileSystems."/" =
{ device = "/dev/disk/by-label/NIXROOT";
fsType = "btrfs";