From 78163bc641d48a9242a68080fb4b6f233578618f Mon Sep 17 00:00:00 2001 From: Martin Wimpress Date: Thu, 21 Sep 2023 13:38:45 +0100 Subject: [PATCH] feat: finalise skull disk array --- nixos/skull/disk-array.nix | 198 +++++++++---------------------------- 1 file changed, 45 insertions(+), 153 deletions(-) diff --git a/nixos/skull/disk-array.nix b/nixos/skull/disk-array.nix index 8245b471a..c80c83a19 100644 --- a/nixos/skull/disk-array.nix +++ b/nixos/skull/disk-array.nix @@ -1,39 +1,42 @@ # nix shell nixpkgs#gptfdisk +# Disk zipper `skull-wipe-array.sh` in the scripts directory # sudo nix run github:nix-community/disko -- --mode zap_create_mount ./disk-array.nix # sudo nix run github:nix-community/disko -- --mode format ./disk-array.nix # sudo nix run github:nix-community/disko -- --mode mount ./disk-array.nix -# Top Card: 4x Transcend MTS830S 2TB -#/dev/disk/by-id/ata-TS2TMTS830S_I021610007 -#/dev/disk/by-id/ata-TS2TMTS830S_I021610011 -#/dev/disk/by-id/ata-TS2TMTS830S_I021610027 -#/dev/disk/by-id/ata-TS2TMTS830S_I021610056 +# Simple sequential write test +# echo 3 | sudo tee /proc/sys/vm/drop_caches +# dd if=/dev/zero of=./test bs=1M count=10240 conv=fdatasync,notrunc status=progress -# Middle Card: 4x Transcend MTS830S 4TB -#/dev/disk/by-id/ata-TS4TMTS830S_H738980002 -#/dev/disk/by-id/ata-TS4TMTS830S_H760910070 -#/dev/disk/by-id/ata-TS4TMTS830S_H760910071 -#/dev/disk/by-id/ata-TS4TMTS830S_H760910072 +# This is becuase is turned out one of the PCI adapters was faulty and I was chasing my tail for a while. +# Find faulty ATA +# dmesg | grep FPDMA | cut -d']' -f2- | sort -u' +# Resolve ATA to drive +# ata=3; ls -l /sys/block/sd* | grep $(grep $ata /sys/class/scsi_host/host*/unique_id | awk -F'/' '{print $5}')') +# ls -l /sys/block/sd* | sed 's/.*\(sd.*\) -.*\(ata.*\)\/h.*/\2 => \1/' +# Watch for errors with: dmesg -wH -# Bottom Card: 4x WD Blue 2TB -#/dev/disk/by-id/ata-WDC_WDS200T2B0B-00YS70_23024Z440206 -#/dev/disk/by-id/ata-WDC_WDS200T2B0B-00YS70_23024Z445606 -#/dev/disk/by-id/ata-WDC_WDS200T2B0B-00YS70_23024Z449709 -#/dev/disk/by-id/missing +# Middle Card (x8): 4x Transcend MTS830S 4TB +#/dev/disk/by-id/ata-TS4TMTS830S_H986540082 (SATA-1) +#/dev/disk/by-id/ata-TS4TMTS830S_H986540080 (SATA-2) +#/dev/disk/by-id/ata-TS4TMTS830S_H986540076 (SATA-3) +#/dev/disk/by-id/ata-TS4TMTS830S_H986540074 (SATA-4) -{ disks ? [ "/dev/disk/by-id/ata-TS4TMTS830S_H738980002" - "/dev/disk/by-id/ata-TS4TMTS830S_H760910070" +# Bottom Card (x8): 4x Transcend MTS830S 4TB +#/dev/disk/by-id/ata-TS4TMTS830S_H738980002 (SATA-1) +#/dev/disk/by-id/ata-TS4TMTS830S_H760910071 (SATA-2) +#/dev/disk/by-id/ata-TS4TMTS830S_H760910070 (SATA-3) +#/dev/disk/by-id/ata-TS4TMTS830S_H760910072 (SATA-4) + +{ disks ? [ "/dev/disk/by-id/ata-TS4TMTS830S_H986540082" + "/dev/disk/by-id/ata-TS4TMTS830S_H986540080" + "/dev/disk/by-id/ata-TS4TMTS830S_H986540076" + "/dev/disk/by-id/ata-TS4TMTS830S_H986540074" + "/dev/disk/by-id/ata-TS4TMTS830S_H738980002" "/dev/disk/by-id/ata-TS4TMTS830S_H760910071" + "/dev/disk/by-id/ata-TS4TMTS830S_H760910070" "/dev/disk/by-id/ata-TS4TMTS830S_H760910072" - "/dev/disk/by-id/ata-TS2TMTS830S_I021610007" - "/dev/disk/by-id/ata-TS2TMTS830S_I021610011" - "/dev/disk/by-id/ata-TS2TMTS830S_I021610027" - "/dev/disk/by-id/ata-TS2TMTS830S_I021610056" - "/dev/disk/by-id/ata-WDC_WDS200T2B0B-00YS70_23024Z440206" - "/dev/disk/by-id/ata-WDC_WDS200T2B0B-00YS70_23024Z445606" - "/dev/disk/by-id/ata-WDC_WDS200T2B0B-00YS70_23024Z449709" - #/dev/disk/by-id/missing ], ... }: let defaultXfsOpts = [ "defaults" "relatime" "nodiratime" ]; @@ -48,7 +51,7 @@ in type = "table"; format = "gpt"; partitions = [{ - name = "TS4-1"; + name = "MID-SATA1"; start = "0%"; end = "100%"; content = { @@ -65,7 +68,7 @@ in type = "table"; format = "gpt"; partitions = [{ - name = "TS4-2"; + name = "MID-SATA2"; start = "0%"; end = "100%"; content = { @@ -82,7 +85,7 @@ in type = "table"; format = "gpt"; partitions = [{ - name = "TS3-3"; + name = "MID-SATA3"; start = "0%"; end = "100%"; content = { @@ -99,7 +102,7 @@ in type = "table"; format = "gpt"; partitions = [{ - name = "TS4-4"; + name = "MID-SATA4"; start = "0%"; end = "100%"; content = { @@ -109,147 +112,79 @@ in }]; }; }; - TS2-1 = { + TS4-5 = { type = "disk"; device = builtins.elemAt disks 4; content = { type = "table"; format = "gpt"; partitions = [{ - name = "TS2-1"; + name = "BOT-SATA1"; start = "0%"; end = "100%"; content = { type = "mdraid"; - name = "TS2"; + name = "TS4"; }; }]; }; }; - TS2-2 = { + TS4-6 = { type = "disk"; device = builtins.elemAt disks 5; content = { type = "table"; format = "gpt"; partitions = [{ - name = "TS2-2"; + name = "BOT-SATA2"; start = "0%"; end = "100%"; content = { type = "mdraid"; - name = "TS2"; + name = "TS4"; }; }]; }; }; - TS2-3 = { + TS4-7 = { type = "disk"; device = builtins.elemAt disks 6; content = { type = "table"; format = "gpt"; partitions = [{ - name = "TS2-3"; + name = "BOT-SATA3"; start = "0%"; end = "100%"; content = { type = "mdraid"; - name = "TS2"; + name = "TS4"; }; }]; }; }; - TS2-4 = { + TS4-8 = { type = "disk"; device = builtins.elemAt disks 7; content = { type = "table"; format = "gpt"; partitions = [{ - name = "TS2-4"; - start = "0%"; - end = "100%"; - content = { - type = "mdraid"; - name = "TS2"; - }; - }]; - }; - }; - WDS2-1 = { - type = "disk"; - device = builtins.elemAt disks 8; - content = { - type = "table"; - format = "gpt"; - partitions = [{ - name = "WDS2-1"; - start = "0%"; - end = "100%"; - content = { - type = "mdraid"; - name = "WDS2"; - }; - }]; - }; - }; - WDS2-2 = { - type = "disk"; - device = builtins.elemAt disks 9; - content = { - type = "table"; - format = "gpt"; - partitions = [{ - name = "WDS2-2"; - start = "0%"; - end = "100%"; - content = { - type = "mdraid"; - name = "WDS2"; - }; - }]; - }; - }; - WDS2-3 = { - type = "disk"; - device = builtins.elemAt disks 10; - content = { - type = "table"; - format = "gpt"; - partitions = [{ - name = "WDS2-3"; + name = "BOT-SATA4"; start = "0%"; end = "100%"; content = { type = "mdraid"; - name = "WDS2"; + name = "TS4"; }; }]; }; }; - #WDS2-4 = { - # type = "disk"; - # device = builtins.elemAt disks 11; - # content = { - # type = "table"; - # format = "gpt"; - # partitions = [{ - # name = "WDS2-4"; - # start = "0%"; - # end = "100%"; - # content = { - # type = "mdraid"; - # name = "WDS2"; - # }; - # }]; - # }; - #}; }; mdadm = { TS4 = { type = "mdadm"; - level = 5; + level = 6; content = { type = "table"; format = "gpt"; @@ -268,49 +203,6 @@ in }]; }; }; - TS2 = { - type = "mdadm"; - level = 5; - content = { - type = "table"; - format = "gpt"; - partitions = [{ - name = "primary"; - start = "0%"; - end = "100%"; - content = { - type = "filesystem"; - # Overwirte the existing filesystem - extraArgs = [ "-f" ]; - format = "xfs"; - mountpoint = "/mnt/TS2"; - mountOptions = defaultXfsOpts; - }; - }]; - }; - }; - WDS2 = { - type = "mdadm"; - # TODO: Temporary while testing a drive is missing - level = 0; - content = { - type = "table"; - format = "gpt"; - partitions = [{ - name = "primary"; - start = "0%"; - end = "100%"; - content = { - type = "filesystem"; - # Overwirte the existing filesystem - extraArgs = [ "-f" ]; - format = "xfs"; - mountpoint = "/mnt/WDS2"; - mountOptions = defaultXfsOpts; - }; - }]; - }; - }; }; }; }