From 6b38429bac3bdc979e84904d34db07a989611c4c Mon Sep 17 00:00:00 2001 From: Nikolaos Karaolidis Date: Sat, 13 Sep 2025 19:20:30 +0000 Subject: [PATCH] 80TiB Signed-off-by: Nikolaos Karaolidis --- flake.nix | 8 +- hosts/jupiter/README.md | 10 +-- hosts/jupiter/default.nix | 2 + hosts/jupiter/format.nix | 58 ++++++++++++- .../podman/grafana/dashboards/system.json | 85 +++++-------------- overlays/tea/default.nix | 2 +- 6 files changed, 94 insertions(+), 71 deletions(-) diff --git a/flake.nix b/flake.nix index 2d2539e..8d9fb64 100644 --- a/flake.nix +++ b/flake.nix @@ -200,13 +200,17 @@ ) ((pkgs.lib.filterAttrs (_: config: config.pkgs.system == system)) inputs.self.nixosConfigurations); - packages = pkgs.lib.mapAttrs' (n: pkgs.lib.nameValuePair "package-${n}") inputs.self.packages; + packages = pkgs.lib.mapAttrs' ( + name: pkgs.lib.nameValuePair "package-${name}" + ) inputs.self.packages.${system}; overlayPackages = pkgs.lib.mapAttrs' (n: pkgs.lib.nameValuePair "overlayPackage-${n}") ( import ./overlays/packages.nix { inherit pkgs; } ); - devShells = pkgs.lib.mapAttrs' (n: pkgs.lib.nameValuePair "devShell-${n}") inputs.self.devShells; + devShells = pkgs.lib.mapAttrs' ( + name: pkgs.lib.nameValuePair "devShell-${name}" + ) inputs.self.devShells.${system}; formatter.formatting = treefmt.config.build.check inputs.self; in diff --git a/hosts/jupiter/README.md b/hosts/jupiter/README.md index 5c95a55..1a95b10 100644 --- a/hosts/jupiter/README.md +++ b/hosts/jupiter/README.md @@ -17,13 +17,13 @@ Remember to update [format.nix](format.nix). ### Adding a new drive +Create a `format.nix` containing the new disk layout. Do not include already existing disks in this file, nor the global pool. + ``` -parted /dev/sdd -- mklabel gpt -parted /dev/sdd -- mkpart primary 0% 100% -cryptsetup luksFormat /dev/sdd -cryptsetup open /dev/sdd storage2 +disko -m "destroy" --yes-wipe-all-disks format.nix +disko -m "format" --yes-wipe-all-disks format.nix btrfs device add /dev/mapper/storage2 /mnt/storage -btrfs balance start -dconvert=raid1 -mconvert=raid1 /mnt/storage +btrfs balance start -dconvert=raid1 -mconvert=raid1 /mnt/storage --bg ``` ### Removing an old drive diff --git a/hosts/jupiter/default.nix b/hosts/jupiter/default.nix index 759b447..d051a37 100644 --- a/hosts/jupiter/default.nix +++ b/hosts/jupiter/default.nix @@ -59,6 +59,8 @@ main.keyFile = "/usb/keyfile"; storage0.keyFile = "/usb/keyfile"; storage1.keyFile = "/usb/keyfile"; + storage2.keyFile = "/usb/keyfile"; + storage3.keyFile = "/usb/keyfile"; }; systemd.contents."/etc/fstab".text = '' diff --git a/hosts/jupiter/format.nix b/hosts/jupiter/format.nix index fec3464..6fe35aa 100644 --- a/hosts/jupiter/format.nix +++ b/hosts/jupiter/format.nix @@ -123,10 +123,66 @@ settings = { allowDiscards = true; }; + }; + }; + }; + }; + }; + + storage2 = { + device = "/dev/disk/by-id/ata-TOSHIBA_MG11ACA24TE_7512A15XF6AL"; + type = "disk"; + content = { + type = "gpt"; + partitions = { + root = { + name = "root"; + size = "100%"; + content = { + name = "storage2"; + type = "luks"; + passwordFile = "/tmp/keyfile"; + settings = { + allowDiscards = true; + }; + }; + }; + }; + }; + }; + + storage3 = { + device = "/dev/disk/by-id/ata-TOSHIBA_MG11ACA24TE_7512A192F6AL"; + type = "disk"; + content = { + type = "gpt"; + partitions = { + root = { + name = "root"; + size = "100%"; + content = { + name = "storage3"; + type = "luks"; + passwordFile = "/tmp/keyfile"; + settings = { + allowDiscards = true; + }; content = { type = "btrfs"; - extraArgs = [ "-f -L storage -m raid1 -d raid1 /dev/mapper/storage0" ]; + extraArgs = [ + "-f" + "-L" + "storage" + "-m" + "raid1" + "-d" + "raid1" + "/dev/mapper/storage0" + "/dev/mapper/storage1" + "/dev/mapper/storage2" + # Implicit /dev/mapper/storage3 + ]; subvolumes = let mountOptions = [ diff --git a/hosts/jupiter/users/storm/configs/console/podman/grafana/dashboards/system.json b/hosts/jupiter/users/storm/configs/console/podman/grafana/dashboards/system.json index edcac78..35f7459 100644 --- a/hosts/jupiter/users/storm/configs/console/podman/grafana/dashboards/system.json +++ b/hosts/jupiter/users/storm/configs/console/podman/grafana/dashboards/system.json @@ -1218,7 +1218,6 @@ "wideLayout": true }, "pluginVersion": "12.1.1", - "repeatDirection": "h", "targets": [ { "editorMode": "code", @@ -3435,7 +3434,7 @@ "h": 1, "w": 24, "x": 0, - "y": 76 + "y": 73 }, "id": 65, "panels": [], @@ -3486,10 +3485,10 @@ "h": 3, "w": 24, "x": 0, - "y": 73 + "y": 74 }, "id": 66, - "maxPerRow": 4, + "maxPerRow": 6, "options": { "colorMode": "value", "graphMode": "none", @@ -3555,6 +3554,7 @@ "y": 77 }, "id": 70, + "maxPerRow": 6, "options": { "colorMode": "value", "graphMode": "none", @@ -3625,6 +3625,7 @@ "y": 80 }, "id": 69, + "maxPerRow": 6, "options": { "colorMode": "value", "graphMode": "none", @@ -3686,6 +3687,7 @@ "y": 83 }, "id": 68, + "maxPerRow": 6, "options": { "colorMode": "value", "graphMode": "none", @@ -3747,6 +3749,7 @@ "y": 86 }, "id": 67, + "maxPerRow": 6, "options": { "colorMode": "value", "graphMode": "none", @@ -3889,7 +3892,7 @@ "y": 90 }, "id": 58, - "maxPerRow": 3, + "maxPerRow": 4, "options": { "legend": { "calcs": [], @@ -3913,18 +3916,6 @@ "legendFormat": "{{block_group_type}}", "range": true, "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "editorMode": "code", - "expr": "min(node_btrfs_device_size_bytes{hostname=\"$hostname\", uuid=\"$btrfs_uuid\"})", - "hide": false, - "legendFormat": "total", - "range": true, - "refId": "B" } ], "title": "Storage Used ($btrfs_uuid)", @@ -3994,7 +3985,7 @@ "y": 98 }, "id": 59, - "maxPerRow": 3, + "maxPerRow": 6, "options": { "legend": { "calcs": [], @@ -4087,7 +4078,7 @@ "y": 106 }, "id": 60, - "maxPerRow": 4, + "maxPerRow": 6, "options": { "legend": { "calcs": [], @@ -4206,6 +4197,7 @@ "y": 115 }, "id": 62, + "maxPerRow": 6, "options": { "legend": { "calcs": [], @@ -4324,6 +4316,7 @@ "y": 123 }, "id": 63, + "maxPerRow": 6, "options": { "legend": { "calcs": [], @@ -4429,6 +4422,7 @@ "y": 131 }, "id": 64, + "maxPerRow": 6, "options": { "legend": { "calcs": [], @@ -4916,7 +4910,7 @@ { "allowCustomValue": false, "current": { - "text": ["All"], + "text": "All", "value": ["$__all"] }, "definition": "label_values(node_cpu_seconds_total{hostname=\"$hostname\"},cpu)", @@ -4956,43 +4950,6 @@ "regex": ".*\\s([0-9]+)\\s.*", "type": "query" }, - { - "current": { - "text": "30", - "value": "30" - }, - "hide": 2, - "label": "extra_watts", - "name": "extra_watts", - "options": [ - { - "selected": true, - "text": "30", - "value": "30" - } - ], - "query": "30", - "type": "custom" - }, - { - "allowCustomValue": false, - "current": { - "text": "0.2350", - "value": "0.2350" - }, - "hide": 2, - "label": "energy_price", - "name": "energy_price", - "options": [ - { - "selected": true, - "text": "0.2350", - "value": "0.2350" - } - ], - "query": "0.2350", - "type": "custom" - }, { "allowCustomValue": false, "current": { @@ -5027,12 +4984,16 @@ "text": [ "5e8dfca5-4c6e-4265-8478-128a0ed4fe57", "601b8df9-94cc-4cf3-93e3-e978605bb3fe", - "a8e4ae38-f617-4dcb-9c13-863f71df2f9f" + "a8e4ae38-f617-4dcb-9c13-863f71df2f9f", + "1e44ec70-5783-4b76-852c-490e0254c9e7", + "64a29172-cdc6-43c5-b8cd-2ca44739a07b" ], "value": [ "5e8dfca5-4c6e-4265-8478-128a0ed4fe57", "601b8df9-94cc-4cf3-93e3-e978605bb3fe", - "a8e4ae38-f617-4dcb-9c13-863f71df2f9f" + "a8e4ae38-f617-4dcb-9c13-863f71df2f9f", + "1e44ec70-5783-4b76-852c-490e0254c9e7", + "64a29172-cdc6-43c5-b8cd-2ca44739a07b" ] }, "definition": "label_values(node_btrfs_device_size_bytes,btrfs_dev_uuid)", @@ -5054,8 +5015,8 @@ { "allowCustomValue": false, "current": { - "text": ["nvme0n1", "sda", "sdb", "sdc"], - "value": ["nvme0n1", "sda", "sdb", "sdc"] + "text": ["nvme0n1", "sda", "sdb", "sdc", "sdd", "sde"], + "value": ["nvme0n1", "sda", "sdb", "sdc", "sdd", "sde"] }, "definition": "label_values(node_disk_info,device)", "description": "", @@ -5076,7 +5037,7 @@ { "allowCustomValue": false, "current": { - "text": ["All"], + "text": "All", "value": ["$__all"] }, "definition": "label_values(smartctl_device,device)", diff --git a/overlays/tea/default.nix b/overlays/tea/default.nix index 470f999..b0335ea 100644 --- a/overlays/tea/default.nix +++ b/overlays/tea/default.nix @@ -9,7 +9,7 @@ prev.tea.overrideAttrs (oldAttrs: { # fix: evaluate env login in repo context (builtins.fetchurl { url = "https://gitea.com/gitea/tea/pulls/809.patch"; - sha256 = "sha256:1f9cyizwmza6kg0r3q5d8h7vvph4wnh7kh3wvi5aqnbw100j7igg"; + sha256 = "sha256:1mmsnzabcdy5lihs51kbx8r1vcr51rfj9a8gl5894jm7qvng7c5d"; }) ]; })