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