Try to fix disk mount failure. Edited podman configuration.
This commit is contained in:
@@ -528,7 +528,11 @@ EOF
|
|||||||
(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
|
||||||
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'
|
||||||
MERGERFS_REQ_DEPS+=" \"x-systemd.requires-mounts-for=/mnt/content-${j}\""$'\n'
|
MOUNT_DEPENDENCIES_START+=" cryptsetup open ${CONTENT_DISK_ID}-part1 crypted-content-${j} --key-file /etc/secrets/disks/content-${j}"$'\n'
|
||||||
|
MOUNT_DEPENDENCIES_START+=" mkdir -p /mnt/content-${j}"$'\n'
|
||||||
|
MOUNT_DEPENDENCIES_START+=" mount /mnt/content-${j}"$'\n'
|
||||||
|
MOUNT_DEPENDENCIES_STOP+=" umount /mnt/content-${j}"$'\n'
|
||||||
|
MOUNT_DEPENDENCIES_STOP+=" cryptsetup close crypted-content-${j}"$'\n'
|
||||||
done
|
done
|
||||||
echo -e "\n✅ Generated $CONTENT_DISK_NUMBER data disk configuration(s)."
|
echo -e "\n✅ Generated $CONTENT_DISK_NUMBER data disk configuration(s)."
|
||||||
j=0
|
j=0
|
||||||
@@ -538,12 +542,18 @@ EOF
|
|||||||
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/parity.nix") >> final-nix-config/etc/nixos/disks/disko.nix
|
(envsubst < "templates/nix-config/disks/parity.nix") >> final-nix-config/etc/nixos/disks/disko.nix
|
||||||
SNAPRAID_PARITY_FILES+=" \"/mnt/parity-${j}/snapraid.parity\""$'\n'
|
SNAPRAID_PARITY_FILES+=" \"/mnt/parity-${j}/snapraid.parity\""$'\n'
|
||||||
|
MOUNT_DEPENDENCIES_START+=" cryptsetup open ${PARITY_DISK_ID} crypted-parity-${j} --key-file /etc/secrets/disks/parity-${j}"$'\n'
|
||||||
|
MOUNT_DEPENDENCIES_START+=" mkdir -p /mnt/parity-${j}"$'\n'
|
||||||
|
MOUNT_DEPENDENCIES_START+=" mount /mnt/parity-${j}"$'\n'
|
||||||
|
MOUNT_DEPENDENCIES_STOP+=" umount /mnt/parity-${j}"$'\n'
|
||||||
|
MOUNT_DEPENDENCIES_STOP+=" cryptsetup close crypted-parity-${j}"$'\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 SNAPRAID_CONTENT_FILES
|
export SNAPRAID_CONTENT_FILES
|
||||||
export SNAPRAID_DATA_DISKS
|
export SNAPRAID_DATA_DISKS
|
||||||
export SNAPRAID_PARITY_FILES
|
export SNAPRAID_PARITY_FILES
|
||||||
export MERGERFS_REQ_DEPS
|
export MOUNT_DEPENDENCIES_START
|
||||||
|
export MOUNT_DEPENDENCIES_STOP
|
||||||
envsubst < templates/nix-config/disks/snapraid.nix > final-nix-config/etc/nixos/disks/snapraid.nix
|
envsubst < templates/nix-config/disks/snapraid.nix > final-nix-config/etc/nixos/disks/snapraid.nix
|
||||||
fi
|
fi
|
||||||
# Close the disko.nix block
|
# Close the disko.nix block
|
||||||
|
|||||||
@@ -9,16 +9,17 @@
|
|||||||
content = {
|
content = {
|
||||||
type = "luks";
|
type = "luks";
|
||||||
name = "crypted-content-${j}";
|
name = "crypted-content-${j}";
|
||||||
|
initrdUnlock = false;
|
||||||
settings = {
|
settings = {
|
||||||
keyFile = "/etc/secrets/disks/content-${j}";
|
keyFile = "/etc/secrets/disks/content-${j}";
|
||||||
allowDiscards = ${ALLOW_DISCARDS:-false};
|
allowDiscards = ${ALLOW_DISCARDS:-false};
|
||||||
crypttabExtraOpts = [ "nofail" ];
|
crypttabExtraOpts = [ "nofail" "noauto" ];
|
||||||
};
|
};
|
||||||
content = {
|
content = {
|
||||||
type = "filesystem";
|
type = "filesystem";
|
||||||
format = "xfs";
|
format = "xfs";
|
||||||
mountpoint = "/mnt/content-${j}";
|
mountpoint = "/mnt/content-${j}";
|
||||||
mountOptions = [ "nofail" "defaults" ];
|
mountOptions = [ "nofail" "noauto" ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -9,16 +9,17 @@
|
|||||||
content = {
|
content = {
|
||||||
type = "luks";
|
type = "luks";
|
||||||
name = "crypted-parity-${j}";
|
name = "crypted-parity-${j}";
|
||||||
|
initrdUnlock = false;
|
||||||
settings = {
|
settings = {
|
||||||
keyFile = "/etc/secrets/disks/parity-${j}";
|
keyFile = "/etc/secrets/disks/parity-${j}";
|
||||||
allowDiscards = ${ALLOW_DISCARDS:-false};
|
allowDiscards = ${ALLOW_DISCARDS:-false};
|
||||||
crypttabExtraOpts = [ "nofail" ];
|
crypttabExtraOpts = [ "nofail" "noauto" ];
|
||||||
};
|
};
|
||||||
content = {
|
content = {
|
||||||
type = "filesystem";
|
type = "filesystem";
|
||||||
format = "xfs";
|
format = "xfs";
|
||||||
mountpoint = "/mnt/parity-${j}";
|
mountpoint = "/mnt/parity-${j}";
|
||||||
mountOptions = [ "nofail" "defaults" ];
|
mountOptions = [ "nofail" "noauto" ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{ config, lib, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
### --> MergerFS setup
|
### --> MergerFS setup
|
||||||
@@ -19,12 +19,31 @@
|
|||||||
"fsname=mergerfs_data"
|
"fsname=mergerfs_data"
|
||||||
"x-mount.mkdir"
|
"x-mount.mkdir"
|
||||||
"x-systemd.automount"
|
"x-systemd.automount"
|
||||||
$MERGERFS_REQ_DEPS
|
"x-systemd.requires=mount-dependencies.service"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
### MergerFS setup <--
|
### MergerFS setup <--
|
||||||
|
|
||||||
|
systemd.services.mount-dependencies = {
|
||||||
|
description = "This service will mount the encrypted disks for mergerFS";
|
||||||
|
after = [ "network.target" ];
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
path = [ pkgs.cryptsetup pkgs.mount ];
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
RemainAfterExit = true;
|
||||||
|
# Bring the service up
|
||||||
|
ExecStart = pkgs.writeShellScript "mount-disks" ''
|
||||||
|
$MOUNT_DEPENDENCIES_START
|
||||||
|
'';
|
||||||
|
# Take it down gracefully
|
||||||
|
ExecStop = pkgs.writeShellScript "unmount-disks" ''
|
||||||
|
$MOUNT_DEPENDENCIES_STOP
|
||||||
|
'';
|
||||||
|
Restart = "on-failure";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
### --> SnapRAID setup
|
### --> SnapRAID setup
|
||||||
services.snapraid = {
|
services.snapraid = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ in
|
|||||||
it-tools:
|
it-tools:
|
||||||
ipv4_address: 172.16.70.253
|
ipv4_address: 172.16.70.253
|
||||||
ports:
|
ports:
|
||||||
- 80:80
|
- 8080:80
|
||||||
- 443:443
|
- 8443:443
|
||||||
volumes:
|
volumes:
|
||||||
- /run/user/1000/podman/podman.sock:/run/docker.sock:ro
|
- /run/user/1000/podman/podman.sock:/run/docker.sock:ro
|
||||||
- ${config_dir}/rules/:/etc/traefik/conf/:ro
|
- ${config_dir}/rules/:/etc/traefik/conf/:ro
|
||||||
|
|||||||
Reference in New Issue
Block a user