nixos-server: fix mounting race condition

This commit is contained in:
2026-08-16 14:34:16 -04:00
parent dc59ca1501
commit 42f4c3c9f6
2 changed files with 29 additions and 0 deletions
+19
View File
@@ -11,5 +11,24 @@ in
../shared/nixos-server.nix
];
systemd.services.mount-vm-disk = {
description = "Mount Proxmox VM disk via kpartx";
after = [ "storage-vm--100--disk--0.device" ];
wants = [ "storage-vm--100--disk--0.device" ];
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
ExecStart = "${pkgs.multipath-tools}/sbin/kpartx -av /dev/storage/vm-100-disk-0";
ExecStop = "${pkgs.multipath-tools}/sbin/kpartx -dv /dev/storage/vm-100-disk-0";
};
wantedBy = [ "multi-user.target" ];
};
environment.systemPackages = with pkgs; [
multipath-tools
];
networking.hostName = "vergil";
}
+10
View File
@@ -55,6 +55,16 @@
"dmask=0077"
];
};
"/mnt" = {
device = "/dev/disk/by-uuid/1432aeae-71e9-4f34-97dc-cf0fe74a4e00";
fsType = "xfs";
options = [
"noauto"
"x-systemd.automount"
"x-systemd.after=mount-vm-disk.service"
];
};
};
swapDevices = [ ];