From b096b8d73be655db08884ac1e0f63ac3b44b1a24 Mon Sep 17 00:00:00 2001 From: MickLesk Date: Sat, 18 Apr 2026 21:42:49 +0200 Subject: [PATCH] fix(clean-orphaned-lvm): check all cluster nodes for VM/CT configs On multi-host clusters with shared storage (iSCSI/NAS), the script only checked the local node's configs (/etc/pve/lxc/ and /etc/pve/qemu-server/) and falsely flagged VMs/CTs running on other nodes as orphaned. Now checks /etc/pve/nodes/*/lxc/ and /etc/pve/nodes/*/qemu-server/ to cover all cluster members. Closes #13827 --- tools/pve/clean-orphaned-lvm.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/pve/clean-orphaned-lvm.sh b/tools/pve/clean-orphaned-lvm.sh index 319497cd7..8d1df7a12 100644 --- a/tools/pve/clean-orphaned-lvm.sh +++ b/tools/pve/clean-orphaned-lvm.sh @@ -37,8 +37,9 @@ function find_orphaned_lvm { fi container_id=$(echo "$lv" | grep -oE "[0-9]+" | head -1) - # Check if the ID exists as a VM or LXC container - if [ -f "/etc/pve/lxc/${container_id}.conf" ] || [ -f "/etc/pve/qemu-server/${container_id}.conf" ]; then + # Check if the ID exists as a VM or LXC container on any cluster node + if compgen -G "/etc/pve/nodes/*/lxc/${container_id}.conf" >/dev/null 2>&1 || + compgen -G "/etc/pve/nodes/*/qemu-server/${container_id}.conf" >/dev/null 2>&1; then continue fi