Update IOMMU-Groups.sh
Add IOMMU-Groups.sh: List PCI devices grouped by IOMMU group This script scans IOMMU groups on the system and lists all associated PCI devices in a clear format. Features: - Lists each IOMMU group numerically. - Displays detailed device info using lspci. - Safe globbing with nullglob enabled. - Works in headless and minimal environments (no color output). Useful for troubleshooting PCIe passthrough setups in KVM/Proxmox environments.
This commit is contained in:
parent
399740ed56
commit
f17155490f
|
|
@ -1,19 +1,35 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
#
|
||||
# Script: IOMMU-Groups.sh
|
||||
# Goal: List PCI devices in IOMMU Groups
|
||||
#
|
||||
# Goal: List PCI devices in IOMMU Groups (no color output)
|
||||
#
|
||||
# Author: Gabriel Luchina
|
||||
# https://luchina.com.br
|
||||
# 20211118T0010
|
||||
# Original: 20211118T0010
|
||||
# Updated: 2025-04-05
|
||||
#
|
||||
|
||||
# Check for root privileges
|
||||
if [ "$EUID" -ne 0 ]; then
|
||||
echo "Warning: It is recommended to run as root for full access."
|
||||
echo "Press Enter to continue as a regular user, or CTRL+C to exit..."
|
||||
read -r
|
||||
fi
|
||||
|
||||
shopt -s nullglob
|
||||
|
||||
for group in `ls /sys/kernel/iommu_groups/ | sort -V`
|
||||
do
|
||||
echo "IOMMU Group ${group##*/}:"
|
||||
for device in /sys/kernel/iommu_groups/$group/devices/*
|
||||
do
|
||||
echo -e "\t$(lspci -nns ${device##*/})"
|
||||
echo "IOMMU Group Devices:"
|
||||
|
||||
for group in $(ls /sys/kernel/iommu_groups/ | sort -V); do
|
||||
group_num=$(echo "$group" | sed 's/[^0-9]*//g')
|
||||
echo "Group $group_num:"
|
||||
for device in /sys/kernel/iommu_groups/$group/devices/*; do
|
||||
dev_id="${device##*/}"
|
||||
info=$(lspci -nns "$dev_id" 2>/dev/null || true)
|
||||
if [[ -z "$info" ]]; then
|
||||
echo -e "\t$dev_id (Unable to get info)"
|
||||
else
|
||||
echo -e "\t$info"
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
|
|
|||
Loading…
Reference in New Issue