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
gdu # disk-space utility, somewhat useful
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
rmlint # probably my favourite app, amazing dupe finder that integrates well with BTRFS
#+end_src
@ -556,8 +556,11 @@ programs.bash = {
f = "fzf --multi --exact -i";
sc = "systemctl --user";
jc = "journalctl --user -xefu";
open-gallery = "cd /mnt/disk2/scrapping/JawZ/gallery-dl && 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";
open-gallery = "cd /mnt/pool/scrapping/JawZ/gallery-dl &&
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;
initExtra = ''
@ -692,6 +695,8 @@ environment = {
wget
jellyfin-ffmpeg # coolest video converter!
dlib
mergerfs
mergerfs-tools
];
variables = rec {
# 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.
#+begin_src nix
snapraid = {
enable = true;
touchBeforeSync = true;
sync.interval = "02:00";
scrub = {
plan = 10;
olderThan = 15;
interval = "4:00";
};
parityFiles = [
"/mnt/parity/snapraid.parity"
];
extraConfig = ''
autosave 5000
'';
exclude = [
"/tmp/"
"/lost+found/"
"/multimedia/downloads/"
"/scrapping/nextcloud/"
"/backups/"
"/glue/Spankbank/unorganized/chaturbate/"
"/nextcloud/nextcloud.log"
"/.Trash-1000"
"/seeding"
];
dataDisks = {
d1 = "/mnt/disk1/";
d2 = "/mnt/disk2/";
d3 = "/mnt/seedbox";
};
contentFiles = [
"/var/snapraid.content"
"/mnt/disk1/snapraid.content"
"/mnt/disk2/snapraid.content"
];
};
# snapraid = {
# enable = true;
# touchBeforeSync = true;
# sync.interval = "02:00";
# scrub = {
# plan = 10;
# olderThan = 15;
# interval = "4:00";
# };
# parityFiles = [
# "/mnt/disks/parity/snapraid.parity"
# ];
# extraConfig = ''
# autosave 5000
# '';
# exclude = [
# "/tmp/"
# "/lost+found/"
# "/multimedia/downloads/"
# "/backups/"
# "/glue/Spankbank/unorganized/chaturbate/"
# "/nextcloud/nextcloud.log"
# "/.Trash-1000/"
# "/seeding/"
# ];
# dataDisks = {
# d1 = "/mnt/disks/disk1/";
# d2 = "/mnt/disks/disk2/";
# d3 = "/mnt/disks/seedbox/";
# };
# contentFiles = [
# "/var/snapraid.content"
# "/mnt/disks/disk1/snapraid.content"
# "/mnt/disks/disk2/snapraid.content"
# ];
# };
#+end_src
* PROGRAMS
@ -837,9 +841,8 @@ services = {
settings = {
inotify = "yes";
media_dir = [
"/mnt/disk2/glue"
"/mnt/seedbox/glue"
"/mnt/disk1/multimedia/downloads"
"/mnt/disks/seedbox"
"/mnt/pool"
];
};
};
@ -852,8 +855,8 @@ services = {
enable = true;
fileSystems = [
"/"
"/mnt/disk1"
"/mnt/disk2"
"/mnt/disks/disk1"
"/mnt/disks/disk2"
];
};
samba-wsdd.enable = true;
@ -873,7 +876,7 @@ services = {
follow symlinks = yes
security = user
hosts allow = 192.168.0.0/16 localhost
hosts allow = 192.168.0. localhost
hosts deny = 0.0.0.0/0
guest account = nobody
map to guest = Bad user
@ -884,9 +887,9 @@ services = {
browseable = "yes";
writable = "yes";
"read only" = "no";
"guest ok" = "no";
"guest ok" = "yes";
# "write list" = "jawz";
"force user" = "jawz";
"write list" = "jawz";
"force group" = "WORKGROUP";
};
in {
@ -933,7 +936,7 @@ systemd = {
serviceConfig = {
Restart = "on-failure";
RestartSec = 30;
WorkingDirectory="/mnt/hnbox";
WorkingDirectory="/mnt/disks/hnbox";
ExecStart = "${pkgs.HentaiAtHome}/bin/HentaiAtHome";
};
};

View File

@ -78,7 +78,7 @@
"datacow"
];
};
"/mnt/disk1" = {
"/mnt/disks/disk1" = {
device = "/dev/mapper/disk1";
fsType = "btrfs";
options = [
@ -89,7 +89,7 @@
"datacow"
];
};
"/mnt/disk2" = {
"/mnt/disks/disk2" = {
device = "/dev/mapper/disk2";
fsType = "btrfs";
options = [
@ -100,7 +100,7 @@
"datacow"
];
};
"/mnt/seedbox" = {
"/mnt/disks/seedbox" = {
device = "/dev/mapper/seedbox";
fsType = "btrfs";
options = [
@ -111,12 +111,12 @@
"datacow"
];
};
"/mnt/parity" = {
"/mnt/disks/parity" = {
device = "/dev/disk/by-uuid/2e437a79-a246-411b-ac21-d03414b14305";
fsType = "ext4";
options = [ "defaults" ];
};
"/mnt/hnbox" = {
"/mnt/disks/hnbox" = {
device = "/dev/mapper/hnbox";
fsType = "btrfs";
options = [ "compress=zstd:3" "space_cache=v2" "commit=120" "datacow" ];
@ -129,10 +129,34 @@
device = "/dev/disk/by-uuid/CBE7-5DEB";
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
"/var/lib/nextcloud/data" = {
device = "/mnt/disk1/nextcloud";
device = "/mnt/pool/nextcloud";
options = [ "bind" ];
depends = [ "/mnt/pool" ];
};
# BTRFS SNAPER
"/mnt/btrfs/disk1" = {
@ -150,39 +174,76 @@
fsType = "btrfs";
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
"/mnt/jellyfin/external" = {
device = "/mnt/seedbox/external";
device = "/mnt/disks/seedbox/external";
options = [ "bind" "ro" ];
depends = [ "/mnt/pool" ];
};
"/mnt/jellyfin/media" = {
device = "/mnt/disk1/multimedia/media";
device = "/mnt/pool/multimedia/media";
options = [ "bind" "ro" ];
depends = [ "/mnt/pool" ];
};
"/mnt/jellyfin/tutorials" = {
device = "/mnt/disk2/tutorials";
device = "/mnt/pool/tutorials";
options = [ "bind" "ro" ];
depends = [ "/mnt/pool" ];
};
"/mnt/jellyfin/workout" = {
device = "/mnt/seedbox/other/P90x.Mega.Pack";
device = "/mnt/disks/seedbox/other/P90x.Mega.Pack";
options = [ "bind" "ro" ];
depends = [ "/mnt/pool" ];
};
# NFS
"/export/disk1" = {
device = "/mnt/disk1";
options = [ "bind" ];
};
"/export/disk2" = {
device = "/mnt/disk2";
options = [ "bind" ];
};
"/export/seedbox" = {
device = "/mnt/seedbox";
"/export/pool" = {
device = "/mnt/pool";
options = [ "bind" ];
depends = [ "/mnt/pool" ];
};
"/export/jawz" = {
device = "/home/jawz";
options = [ "bind" ];
depends = [ "/mnt/pool" ];
};
"/export/seedbox" = {
device = "/mnt/disks/seedbox";
options = [ "bind" ];
depends = [ "/mnt/disks/seedbox" ];
};
};
services.nfs = {
@ -190,10 +251,9 @@
enable = true;
exports = ''
/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/seedbox workstation(rw,nohide,insecure,no_subtree_check)
/export/pool workstation(rw,nohide,insecure,no_subtree_check)
'';
};
};