From 0b41b207adbe175719035e665a4f3b4a0e09bbfd Mon Sep 17 00:00:00 2001 From: Thomas Boerger Date: Tue, 25 Oct 2022 11:04:28 +0200 Subject: [PATCH] chore: more fixes to filesystem creation --- machines/asgard/filesystems.nix | 9 ---- machines/services/default.nix | 1 + machines/services/samba.nix | 13 ------ machines/utgard/filesystems.nix | 26 +++++------ scripts/asgard-partitions | 11 ----- scripts/utgard-partitions | 76 +++++++-------------------------- 6 files changed, 28 insertions(+), 108 deletions(-) diff --git a/machines/asgard/filesystems.nix b/machines/asgard/filesystems.nix index 4e08aa8..97650ee 100644 --- a/machines/asgard/filesystems.nix +++ b/machines/asgard/filesystems.nix @@ -91,15 +91,6 @@ ]; }; - fileSystems."/var/lib/media/downloads" = { - device = "/dev/disk/by-label/downloads"; - fsType = "ext4"; - options = [ - "noatime" - "discard" - ]; - }; - fileSystems."/var/lib/printer" = { device = "/dev/disk/by-label/printer"; fsType = "ext4"; diff --git a/machines/services/default.nix b/machines/services/default.nix index 4e7487f..3cbe24a 100644 --- a/machines/services/default.nix +++ b/machines/services/default.nix @@ -14,6 +14,7 @@ ./media.nix ./nixbuild.nix ./openssh.nix + ./samba.nix ./tailscale.nix ./timesyncd.nix ./webserver.nix diff --git a/machines/services/samba.nix b/machines/services/samba.nix index 04745c3..33a07ca 100644 --- a/machines/services/samba.nix +++ b/machines/services/samba.nix @@ -151,19 +151,6 @@ in "valid users" = "media"; }; - downloads = { - comment = "Shared downloads"; - path = "/var/lib/media/downloads"; - - "browseable" = "no"; - "read only" = "no"; - "writeable" = "yes"; - "guest ok" = "no"; - "force user" = "media"; - "force group" = "media"; - "valid users" = "media"; - }; - printer = { comment = "Shared printer"; path = "/var/lib/printer"; diff --git a/machines/utgard/filesystems.nix b/machines/utgard/filesystems.nix index c60ee65..b9c456d 100644 --- a/machines/utgard/filesystems.nix +++ b/machines/utgard/filesystems.nix @@ -128,6 +128,17 @@ in ]; }; + fileSystems."/var/lib/media/downloads" = { + device = "/dev/disk/by-label/downloads"; + fsType = "ext4"; + options = [ + "noatime" + "discard" + ]; + }; + + + fileSystems."/var/lib/media/movies" = { device = "/dev/disk/by-label/movies"; fsType = "ext4"; @@ -188,21 +199,6 @@ in # options = cifsOptions; # }; - fileSystems."/var/lib/media/downloads" = { - device = "/dev/disk/by-label/downloads"; - fsType = "ext4"; - options = [ - "noatime" - "discard" - ]; - }; - - # fileSystems."/var/lib/media/downloads" = { - # device = "${cifsServer}/downloads"; - # fsType = "cifs"; - # options = cifsOptions; - # }; - age.secrets."users/media/smbpasswd" = { file = ../../secrets/users/media/smbpasswd.age; }; diff --git a/scripts/asgard-partitions b/scripts/asgard-partitions index 6292838..89013fc 100755 --- a/scripts/asgard-partitions +++ b/scripts/asgard-partitions @@ -181,17 +181,6 @@ mkdir -p /mnt/var/lib/media/music mount -t ext4 /dev/tank/music /mnt/var/lib/media/music chown 20000:20000 /mnt/var/lib/media/music -echo "-----> Create downloads volume" -lvcreate --size 100G --name downloads tank - -echo "-----> Create downloads filesystem" -mkfs.ext4 -L downloads /dev/tank/downloads - -echo "-----> Mount downloads filesystem" -mkdir -p /mnt/var/lib/media/downloads -mount -t ext4 /dev/tank/downloads /mnt/var/lib/media/downloads -chown 20000:20000 /mnt/var/lib/media/downloads - echo "-----> Create printer volume" lvcreate --size 5G --name printer tank diff --git a/scripts/utgard-partitions b/scripts/utgard-partitions index 8f52cab..f0f67f7 100755 --- a/scripts/utgard-partitions +++ b/scripts/utgard-partitions @@ -82,6 +82,18 @@ echo "-----> Mount boot filesystem" mkdir /mnt/boot mount /dev/disk/by-label/boot /mnt/boot +for PARTITION in acme nzbget jellyfin bazarr lidarr prowlarr radarr readarr sonarr; do + echo "-----> Create ${PARTITION} volume" + lvcreate --size 5G --name ${PARTITION} system + + echo "-----> Create ${PARTITION} filesystem" + mkfs.ext4 -L ${PARTITION} /dev/system/${PARTITION} + + echo "-----> Mount ${PARTITION} filesystem" + mkdir /mnt/var/lib/${PARTITION} + mount -t ext4 /dev/system/${PARTITION} /mnt/var/lib/${PARTITION} +done + echo "-----> Create tank partition" sgdisk -n 0:0:0 -t 0:8300 -c 0:tank /dev/sdb @@ -92,68 +104,12 @@ echo "-----> Create tank vg" vgcreate tank /dev/disk/by-partlabel/tank echo "-----> Create downloads volume" -lvcreate --size 50G --name downloads tank +lvcreate --size 200G --name downloads tank echo "-----> Create downloads filesystem" mkfs.ext4 -L downloads /dev/tank/downloads echo "-----> Mount downloads filesystem" -mkdir -p /var/lib/media/downloads -mount -t ext4 /dev/tank/downloads /var/lib/media/downloads -chown 20000:20000 /var/lib/media/downloads - -echo "-----> Create movies volume" -lvcreate --size 200G --name movies tank - -echo "-----> Create movies filesystem" -mkfs.ext4 -L movies /dev/tank/movies - -echo "-----> Mount movies filesystem" -mkdir -p /var/lib/media/movies -mount -t ext4 /dev/tank/movies /var/lib/media/movies -chown 20000:20000 /var/lib/media/movies - -echo "-----> Create series volume" -lvcreate --size 300G --name series tank - -echo "-----> Create series filesystem" -mkfs.ext4 -L series /dev/tank/series - -echo "-----> Mount series filesystem" -mkdir -p /var/lib/media/series -mount -t ext4 /dev/tank/series /var/lib/media/series -chown 20000:20000 /var/lib/media/series - -echo "-----> Create books volume" -lvcreate --size 50G --name books tank - -echo "-----> Create books filesystem" -mkfs.ext4 -L books /dev/tank/books - -echo "-----> Mount books filesystem" -mkdir -p /var/lib/media/books -mount -t ext4 /dev/tank/books /var/lib/media/books -chown 20000:20000 /var/lib/media/books - -echo "-----> Create music volume" -lvcreate --size 50G --name music tank - -echo "-----> Create music filesystem" -mkfs.ext4 -L music /dev/tank/music - -echo "-----> Mount music filesystem" -mkdir -p /var/lib/media/music -mount -t ext4 /dev/tank/music /var/lib/media/music -chown 20000:20000 /var/lib/media/music - -for PARTITION in acme nzbget jellyfin bazarr lidarr prowlarr radarr readarr sonarr; do - echo "-----> Create ${PARTITION} volume" - lvcreate --size 5G --name ${PARTITION} system - - echo "-----> Create ${PARTITION} filesystem" - mkfs.ext4 -L ${PARTITION} /dev/system/${PARTITION} - - echo "-----> Mount ${PARTITION} filesystem" - mkdir /var/lib/${PARTITION} - mount -t ext4 /dev/system/${PARTITION} /var/lib/${PARTITION} -done +mkdir -p /mnt/var/lib/media/downloads +mount -t ext4 /dev/tank/downloads /mnt/var/lib/media/downloads +chown 20000:20000 /mnt/var/lib/media/downloads