Edited disk configuration
This commit is contained in:
@@ -516,7 +516,6 @@ EOF
|
||||
export CONTENT_DISK_ID="${DATA_DISKS_ID[${i}]}"
|
||||
if [[ "${DATA_DISKS_TYPE[${i}]}" == "HDD" ]]; then export ALLOW_DISCARDS="false"; else export ALLOW_DISCARDS="true"; fi
|
||||
(envsubst < "templates/nix-config/disks/content.nix") >> final-nix-config/etc/nixos/disks/disko.nix
|
||||
MERGERFS_MOUNTS+="/mnt/content-${j}:"
|
||||
SNAPRAID_CONTENT_FILES+=" \"/mnt/content-${j}/snapraid.content\""$'\n'
|
||||
SNAPRAID_DATA_DISKS+=" d${j} = \"/mnt/content-${j}\";"$'\n'
|
||||
done
|
||||
@@ -530,7 +529,6 @@ EOF
|
||||
SNAPRAID_PARITY_FILES+=" \"/mnt/parity-${j}/snapraid.parity\""$'\n'
|
||||
done
|
||||
echo -e "\n✅ Generated $PARITY_DISK_NUMBER parity disk configuration(s)."
|
||||
export MERGERFS_MOUNTS=${MERGERFS_MOUNTS%}
|
||||
export SNAPRAID_CONTENT_FILES
|
||||
export SNAPRAID_DATA_DISKS
|
||||
export SNAPRAID_PARITY_FILES
|
||||
@@ -570,23 +568,23 @@ EOF
|
||||
chmod 600 "final-nix-config/etc/secrets/disks/boot-disk-${i}"
|
||||
ssh_to_host 'bash -s' << EOF
|
||||
echo "$REMOTE_PASS" | sudo -S mkdir -p /etc/secrets/disks/
|
||||
echo "$REMOTE_PASS" | sudo -S bash -c "printf '%s' '$PASS' > /etc/secrets/disks/boot-disk-${i}"
|
||||
echo "$REMOTE_PASS" | sudo -S bash -c "printf '%s' '$PASS' > /etc/secrets/disks/boot-${i}"
|
||||
EOF
|
||||
done
|
||||
for i in $(seq 1 "$CONTENT_DISK_NUMBER"); do
|
||||
PASS="$(xkcdpass -n 1)"
|
||||
echo -n "$PASS" > "final-nix-config/etc/secrets/disks/content-disk-${i}"
|
||||
chmod 600 "final-nix-config/etc/secrets/disks/content-disk-${i}"
|
||||
echo -n "$PASS" > "final-nix-config/etc/secrets/disks/content-${i}"
|
||||
chmod 600 "final-nix-config/etc/secrets/disks/content-${i}"
|
||||
ssh_to_host 'bash -s' << EOF
|
||||
echo "$REMOTE_PASS" | sudo -S bash -c "printf '%s' '$PASS' > /etc/secrets/disks/content-disk-${i}"
|
||||
echo "$REMOTE_PASS" | sudo -S bash -c "printf '%s' '$PASS' > /etc/secrets/disks/content-${i}"
|
||||
EOF
|
||||
done
|
||||
for i in $(seq 1 "$PARITY_DISK_NUMBER"); do
|
||||
PASS="$(xkcdpass -n 1)"
|
||||
echo -n "$PASS" > "final-nix-config/etc/secrets/disks/parity-disk-${i}"
|
||||
chmod 600 "final-nix-config/etc/secrets/disks/parity-disk-${i}"
|
||||
echo -n "$PASS" > "final-nix-config/etc/secrets/disks/parity-${i}"
|
||||
chmod 600 "final-nix-config/etc/secrets/disks/parity-${i}"
|
||||
ssh_to_host 'bash -s' << EOF
|
||||
echo "$REMOTE_PASS" | sudo -S bash -c "printf '%s' '$PASS' > /etc/secrets/disks/parity-disk-${i}"
|
||||
echo "$REMOTE_PASS" | sudo -S bash -c "printf '%s' '$PASS' > /etc/secrets/disks/parity-${i}"
|
||||
EOF
|
||||
done
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
};
|
||||
disk = {
|
||||
# Boot disk
|
||||
"system-1" = {
|
||||
"boot-1" = {
|
||||
type = "disk";
|
||||
device = "${BOOT_DISK_1_ID}";
|
||||
content = {
|
||||
@@ -43,7 +43,7 @@
|
||||
type = "luks";
|
||||
name = "crypted-boot-1";
|
||||
settings = {
|
||||
keyFile = "/etc/secrets/disks/boot-disk-1";
|
||||
keyFile = "/etc/secrets/disks/boot-1";
|
||||
allowDiscards = true;
|
||||
};
|
||||
content = {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
{
|
||||
disko.devices = {
|
||||
disk = {
|
||||
"system-1" = {
|
||||
"boot-1" = {
|
||||
type = "disk";
|
||||
device = "${BOOT_DISK_1_ID}";
|
||||
content = {
|
||||
@@ -24,7 +24,7 @@
|
||||
type = "luks";
|
||||
name = "crypted-boot-1";
|
||||
settings = {
|
||||
keyFile = "/etc/secrets/disks/boot-disk-1";
|
||||
keyFile = "/etc/secrets/disks/boot-1";
|
||||
allowDiscards = true;
|
||||
};
|
||||
};
|
||||
@@ -32,7 +32,7 @@
|
||||
};
|
||||
};
|
||||
};
|
||||
"system-2" = {
|
||||
"boot-2" = {
|
||||
type = "disk";
|
||||
device = "${BOOT_DISK_2_ID}";
|
||||
content = {
|
||||
@@ -44,7 +44,7 @@
|
||||
type = "luks";
|
||||
name = "crypted-boot-2";
|
||||
settings = {
|
||||
keyFile = "/etc/secrets/disks/boot-disk-2";
|
||||
keyFile = "/etc/secrets/disks/boot-2";
|
||||
allowDiscards = true;
|
||||
};
|
||||
content = {
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
name = "crypted-content-${j}";
|
||||
initrdUnlock = false;
|
||||
settings = {
|
||||
keyFile = "/etc/secrets/disks/content-disk-${j}";
|
||||
keyFile = "/etc/secrets/disks/content-${j}";
|
||||
allowDiscards = ${ALLOW_DISCARDS:-false};
|
||||
};
|
||||
content = {
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
content = {
|
||||
type = "luks";
|
||||
name = "crypted-content-1";
|
||||
settings.keyFile = "/etc/secrets/disks/content-disk-1";
|
||||
settings.keyFile = "/etc/secrets/disks/content-1";
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -29,7 +29,7 @@
|
||||
content = {
|
||||
type = "luks";
|
||||
name = "crypted-parity-1";
|
||||
settings.keyFile = "/etc/secrets/disks/parity-disk-1";
|
||||
settings.keyFile = "/etc/secrets/disks/parity-1";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
name = "crypted-parity-${j}";
|
||||
initrdUnlock = false;
|
||||
settings = {
|
||||
keyFile = "/etc/secrets/disks/parity-disk-${j}";
|
||||
keyFile = "/etc/secrets/disks/parity-${j}";
|
||||
allowDiscards = ${ALLOW_DISCARDS:-false};
|
||||
};
|
||||
content = {
|
||||
|
||||
@@ -1,20 +1,23 @@
|
||||
{ config, lib, ... }:
|
||||
|
||||
### --> MergerFS setup
|
||||
{
|
||||
fileSystems."/mnt/data-storage" = {
|
||||
device = "mergerfs";
|
||||
fsType = "fuse";
|
||||
device = "/mnt/content-*";
|
||||
fsType = "fuse.mergerfs";
|
||||
options = [
|
||||
"category.create=ff"
|
||||
"cache.files=partial"
|
||||
"dropcacheonclose=true"
|
||||
"defaults"
|
||||
"allow_other"
|
||||
"use_ino"
|
||||
"cache.files=off"
|
||||
"moveonenospc=true"
|
||||
"category.create=mfs"
|
||||
"srcmounts=$MERGERFS_MOUNTS"
|
||||
"moveonenospc=1"
|
||||
"minfreespace=50G"
|
||||
"func.getattr=newest"
|
||||
"fsname=mergerfs_data"
|
||||
"x-mount.mkdir"
|
||||
];
|
||||
};
|
||||
|
||||
### MergerFS setup <--
|
||||
|
||||
### --> SnapRAID setup
|
||||
|
||||
Reference in New Issue
Block a user