From 8842efc19b1ba1a6e1a1e6b3725b0dfa267132b7 Mon Sep 17 00:00:00 2001 From: MacRimi <123239993+MacRimi@users.noreply.github.com> Date: Tue, 8 Apr 2025 09:42:10 +0200 Subject: [PATCH] Update disk-passthrough.sh --- scripts/disk-passthrough.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/scripts/disk-passthrough.sh b/scripts/disk-passthrough.sh index b127283..f7bd125 100644 --- a/scripts/disk-passthrough.sh +++ b/scripts/disk-passthrough.sh @@ -173,11 +173,17 @@ while read -r DISK; do USED_BY="" + REAL_PATH=$(readlink -f "$DISK") CONFIG_DATA=$(cat /etc/pve/qemu-server/*.conf /etc/pve/lxc/*.conf 2>/dev/null) - if grep -Fq "$DISK" <<< "$CONFIG_DATA"; then - USED_BY="[in use ct or vm]" - fi + for SYMLINK in /dev/disk/by-id/*; do + if [[ "$(readlink -f "$SYMLINK")" == "$REAL_PATH" ]]; then + if grep -Fq "$SYMLINK" <<< "$CONFIG_DATA"; then + USED_BY="[in use ct or vm]" + break + fi + fi + done