mergerfs migration server/scripts

This commit is contained in:
Danilo Reyes 2023-10-01 15:51:36 -06:00
parent 4226d0b422
commit 2b022b59e6
2 changed files with 135 additions and 72 deletions

View File

@ -375,7 +375,7 @@ fd # modern find, faster searches
fzf # fuzzy finder! super cool and useful fzf # fuzzy finder! super cool and useful
gdu # disk-space utility, somewhat useful gdu # disk-space utility, somewhat useful
du-dust # rusty du du-dust # rusty du
trashy # oop! didn't meant to delete that trash-cli # oop! didn't meant to delete that
unstable.eza # like ls but with colors unstable.eza # like ls but with colors
rmlint # probably my favourite app, amazing dupe finder that integrates well with BTRFS rmlint # probably my favourite app, amazing dupe finder that integrates well with BTRFS
#+end_src #+end_src
@ -556,8 +556,11 @@ programs.bash = {
f = "fzf --multi --exact -i"; f = "fzf --multi --exact -i";
sc = "systemctl --user"; sc = "systemctl --user";
jc = "journalctl --user -xefu"; jc = "journalctl --user -xefu";
open-gallery = "cd /mnt/disk2/scrapping/JawZ/gallery-dl && xdg-open $(fd . ./ Husbands -tdirectory -d 1 | fzf -i)\""; open-gallery = "cd /mnt/pool/scrapping/JawZ/gallery-dl &&
unique-extensions = "fd -tf | rev | cut -d. -f1 | rev | tr '[:upper:]' '[:lower:]' | sort | uniq --count | sort -rn"; xdg-open $(fd . ./ Husbands -tdirectory -d 1 | fzf -i)\"";
unique-extensions = "fd -tf | rev | cut -d. -f1 | rev |
tr '[:upper:]' '[:lower:]' | sort |
uniq --count | sort -rn";
}; };
enableVteIntegration = true; enableVteIntegration = true;
initExtra = '' initExtra = ''
@ -692,6 +695,8 @@ environment = {
wget wget
jellyfin-ffmpeg # coolest video converter! jellyfin-ffmpeg # coolest video converter!
dlib dlib
mergerfs
mergerfs-tools
]; ];
variables = rec { variables = rec {
# PATH # PATH
@ -751,43 +756,42 @@ historic backup of your files, I am more concerned with the whole disk recovery
in case of failure, as such a frequent sync fits my preferences. in case of failure, as such a frequent sync fits my preferences.
#+begin_src nix #+begin_src nix
snapraid = { # snapraid = {
enable = true; # enable = true;
touchBeforeSync = true; # touchBeforeSync = true;
sync.interval = "02:00"; # sync.interval = "02:00";
scrub = { # scrub = {
plan = 10; # plan = 10;
olderThan = 15; # olderThan = 15;
interval = "4:00"; # interval = "4:00";
}; # };
parityFiles = [ # parityFiles = [
"/mnt/parity/snapraid.parity" # "/mnt/disks/parity/snapraid.parity"
]; # ];
extraConfig = '' # extraConfig = ''
autosave 5000 # autosave 5000
''; # '';
exclude = [ # exclude = [
"/tmp/" # "/tmp/"
"/lost+found/" # "/lost+found/"
"/multimedia/downloads/" # "/multimedia/downloads/"
"/scrapping/nextcloud/" # "/backups/"
"/backups/" # "/glue/Spankbank/unorganized/chaturbate/"
"/glue/Spankbank/unorganized/chaturbate/" # "/nextcloud/nextcloud.log"
"/nextcloud/nextcloud.log" # "/.Trash-1000/"
"/.Trash-1000" # "/seeding/"
"/seeding" # ];
]; # dataDisks = {
dataDisks = { # d1 = "/mnt/disks/disk1/";
d1 = "/mnt/disk1/"; # d2 = "/mnt/disks/disk2/";
d2 = "/mnt/disk2/"; # d3 = "/mnt/disks/seedbox/";
d3 = "/mnt/seedbox"; # };
}; # contentFiles = [
contentFiles = [ # "/var/snapraid.content"
"/var/snapraid.content" # "/mnt/disks/disk1/snapraid.content"
"/mnt/disk1/snapraid.content" # "/mnt/disks/disk2/snapraid.content"
"/mnt/disk2/snapraid.content" # ];
]; # };
};
#+end_src #+end_src
* PROGRAMS * PROGRAMS
@ -837,9 +841,8 @@ services = {
settings = { settings = {
inotify = "yes"; inotify = "yes";
media_dir = [ media_dir = [
"/mnt/disk2/glue" "/mnt/disks/seedbox"
"/mnt/seedbox/glue" "/mnt/pool"
"/mnt/disk1/multimedia/downloads"
]; ];
}; };
}; };
@ -852,8 +855,8 @@ services = {
enable = true; enable = true;
fileSystems = [ fileSystems = [
"/" "/"
"/mnt/disk1" "/mnt/disks/disk1"
"/mnt/disk2" "/mnt/disks/disk2"
]; ];
}; };
samba-wsdd.enable = true; samba-wsdd.enable = true;
@ -873,7 +876,7 @@ services = {
follow symlinks = yes follow symlinks = yes
security = user security = user
hosts allow = 192.168.0.0/16 localhost hosts allow = 192.168.0. localhost
hosts deny = 0.0.0.0/0 hosts deny = 0.0.0.0/0
guest account = nobody guest account = nobody
map to guest = Bad user map to guest = Bad user
@ -884,9 +887,9 @@ services = {
browseable = "yes"; browseable = "yes";
writable = "yes"; writable = "yes";
"read only" = "no"; "read only" = "no";
"guest ok" = "no"; "guest ok" = "yes";
# "write list" = "jawz";
"force user" = "jawz"; "force user" = "jawz";
"write list" = "jawz";
"force group" = "WORKGROUP"; "force group" = "WORKGROUP";
}; };
in { in {
@ -933,7 +936,7 @@ systemd = {
serviceConfig = { serviceConfig = {
Restart = "on-failure"; Restart = "on-failure";
RestartSec = 30; RestartSec = 30;
WorkingDirectory="/mnt/hnbox"; WorkingDirectory="/mnt/disks/hnbox";
ExecStart = "${pkgs.HentaiAtHome}/bin/HentaiAtHome"; ExecStart = "${pkgs.HentaiAtHome}/bin/HentaiAtHome";
}; };
}; };

View File

@ -78,7 +78,7 @@
"datacow" "datacow"
]; ];
}; };
"/mnt/disk1" = { "/mnt/disks/disk1" = {
device = "/dev/mapper/disk1"; device = "/dev/mapper/disk1";
fsType = "btrfs"; fsType = "btrfs";
options = [ options = [
@ -89,7 +89,7 @@
"datacow" "datacow"
]; ];
}; };
"/mnt/disk2" = { "/mnt/disks/disk2" = {
device = "/dev/mapper/disk2"; device = "/dev/mapper/disk2";
fsType = "btrfs"; fsType = "btrfs";
options = [ options = [
@ -100,7 +100,7 @@
"datacow" "datacow"
]; ];
}; };
"/mnt/seedbox" = { "/mnt/disks/seedbox" = {
device = "/dev/mapper/seedbox"; device = "/dev/mapper/seedbox";
fsType = "btrfs"; fsType = "btrfs";
options = [ options = [
@ -111,12 +111,12 @@
"datacow" "datacow"
]; ];
}; };
"/mnt/parity" = { "/mnt/disks/parity" = {
device = "/dev/disk/by-uuid/2e437a79-a246-411b-ac21-d03414b14305"; device = "/dev/disk/by-uuid/2e437a79-a246-411b-ac21-d03414b14305";
fsType = "ext4"; fsType = "ext4";
options = [ "defaults" ]; options = [ "defaults" ];
}; };
"/mnt/hnbox" = { "/mnt/disks/hnbox" = {
device = "/dev/mapper/hnbox"; device = "/dev/mapper/hnbox";
fsType = "btrfs"; fsType = "btrfs";
options = [ "compress=zstd:3" "space_cache=v2" "commit=120" "datacow" ]; options = [ "compress=zstd:3" "space_cache=v2" "commit=120" "datacow" ];
@ -129,10 +129,34 @@
device = "/dev/disk/by-uuid/CBE7-5DEB"; device = "/dev/disk/by-uuid/CBE7-5DEB";
fsType = "vfat"; fsType = "vfat";
}; };
"/mnt/pool" = {
device = "/mnt/disks/disk1:/mnt/disks/disk2";
fsType = "fuse.mergerfs";
options = [
"allow_other"
"noforget"
"func.getattr=newest"
"category.create=mfs"
"category.action=mfs"
"cache.files=partial"
"dropcacheonclose=true"
"inodecalc=path-hash"
"link_cow=true"
"nfsopenhack=all"
];
depends = [
"/mnt/disks/disk1"
"/mnt/disks/disk2"
"/mnt/disks/seedbox"
"/mnt/disks/parity"
"/mnt/disks/hnbox"
];
};
# NEXTCCLOUD # NEXTCCLOUD
"/var/lib/nextcloud/data" = { "/var/lib/nextcloud/data" = {
device = "/mnt/disk1/nextcloud"; device = "/mnt/pool/nextcloud";
options = [ "bind" ]; options = [ "bind" ];
depends = [ "/mnt/pool" ];
}; };
# BTRFS SNAPER # BTRFS SNAPER
"/mnt/btrfs/disk1" = { "/mnt/btrfs/disk1" = {
@ -150,39 +174,76 @@
fsType = "btrfs"; fsType = "btrfs";
options = [ "compress=zstd:3" "space_cache=v2" "commit=120" "datacow" ]; options = [ "compress=zstd:3" "space_cache=v2" "commit=120" "datacow" ];
}; };
# snapraid content
"/mnt/snapraid/disk1" = {
device = "/dev/mapper/disk1";
fsType = "btrfs";
options = [
"subvol=@snapraid"
"compress=zstd:3"
"space_cache=v2"
"commit=120"
"datacow"
];
};
"/mnt/snapraid/disk2" = {
device = "/dev/mapper/disk2";
fsType = "btrfs";
options = [
"subvol=@snapraid"
"compress=zstd:3"
"space_cache=v2"
"commit=120"
"datacow"
];
};
"/mnt/snapraid/seedbox" = {
device = "/dev/mapper/seedbox";
fsType = "btrfs";
options = [
"subvol=@snapraid"
"compress=zstd:3"
"space_cache=v2"
"commit=120"
"datacow"
];
};
# Jellyfin RO # Jellyfin RO
"/mnt/jellyfin/external" = { "/mnt/jellyfin/external" = {
device = "/mnt/seedbox/external"; device = "/mnt/disks/seedbox/external";
options = [ "bind" "ro" ]; options = [ "bind" "ro" ];
depends = [ "/mnt/pool" ];
}; };
"/mnt/jellyfin/media" = { "/mnt/jellyfin/media" = {
device = "/mnt/disk1/multimedia/media"; device = "/mnt/pool/multimedia/media";
options = [ "bind" "ro" ]; options = [ "bind" "ro" ];
depends = [ "/mnt/pool" ];
}; };
"/mnt/jellyfin/tutorials" = { "/mnt/jellyfin/tutorials" = {
device = "/mnt/disk2/tutorials"; device = "/mnt/pool/tutorials";
options = [ "bind" "ro" ]; options = [ "bind" "ro" ];
depends = [ "/mnt/pool" ];
}; };
"/mnt/jellyfin/workout" = { "/mnt/jellyfin/workout" = {
device = "/mnt/seedbox/other/P90x.Mega.Pack"; device = "/mnt/disks/seedbox/other/P90x.Mega.Pack";
options = [ "bind" "ro" ]; options = [ "bind" "ro" ];
depends = [ "/mnt/pool" ];
}; };
# NFS # NFS
"/export/disk1" = { "/export/pool" = {
device = "/mnt/disk1"; device = "/mnt/pool";
options = [ "bind" ];
};
"/export/disk2" = {
device = "/mnt/disk2";
options = [ "bind" ];
};
"/export/seedbox" = {
device = "/mnt/seedbox";
options = [ "bind" ]; options = [ "bind" ];
depends = [ "/mnt/pool" ];
}; };
"/export/jawz" = { "/export/jawz" = {
device = "/home/jawz"; device = "/home/jawz";
options = [ "bind" ]; options = [ "bind" ];
depends = [ "/mnt/pool" ];
};
"/export/seedbox" = {
device = "/mnt/disks/seedbox";
options = [ "bind" ];
depends = [ "/mnt/disks/seedbox" ];
}; };
}; };
services.nfs = { services.nfs = {
@ -190,10 +251,9 @@
enable = true; enable = true;
exports = '' exports = ''
/export workstation(rw,fsid=0,no_subtree_check) /export workstation(rw,fsid=0,no_subtree_check)
/export/disk1 workstation(rw,nohide,insecure,no_subtree_check)
/export/disk2 workstation(rw,nohide,insecure,no_subtree_check)
/export/seedbox workstation(rw,nohide,insecure,no_subtree_check)
/export/jawz workstation(rw,nohide,insecure,no_subtree_check) /export/jawz workstation(rw,nohide,insecure,no_subtree_check)
/export/seedbox workstation(rw,nohide,insecure,no_subtree_check)
/export/pool workstation(rw,nohide,insecure,no_subtree_check)
''; '';
}; };
}; };