pve開啟硬件直通命令
1、打開PVE節點的shell,輸入命令:
nano /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="quiet"
#inter cpu改為:
GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on iommu=pt"
#如果是amd cpu請改為:
GRUB_CMDLINE_LINUX_DEFAULT="quiet amd_iommu=on iommu=pt"
編輯完文件后按 【 Ctrl + X 】 【 Y 】 回車
2、繼續輸入以下命令
echo vfio >> /etc/modules
echo vfio_iommu_type1 >> /etc/modules
echo vfio_pci >> /etc/modules
echo vfio_virqfd >> /etc/modules
3、最后更新配置信息并重啟PVE主機
update-grub
update-initramfs -u -k all
reboot
4、驗證是否開啟iommu,在終端輸入
dmesg | grep iommu
出現如下例子。則代表成功
[ 1.341100] pci 0000:00:00.0: Adding to iommu group 0
[ 1.341116] pci 0000:00:01.0: Adding to iommu group 1
[ 1.341126] pci 0000:00:02.0: Adding to iommu group 2
[ 1.341137] pci 0000:00:14.0: Adding to iommu group 3
[ 1.341146] pci 0000:00:17.0: Adding to iommu group 4
執行命令:
find /sys/kernel/iommu_groups/ -type l
#出現很多直通組,就代表成功了。如果沒有任何東西,就是沒有開啟
/sys/kernel/iommu_groups/4/devices/0000:00:12.0
/sys/kernel/iommu_groups/22/devices/0000:07:00.0
/sys/kernel/iommu_groups/12/devices/0000:00:1d.0
/sys/kernel/iommu_groups/2/devices/0000:00:01.2
/sys/kernel/iommu_groups/2/devices/0000:02:00.0
/sys/kernel/iommu_groups/2/devices/0000:00:01.0
/sys/kernel/iommu_groups/20/devices/0000:06:02.0
/sys/kernel/iommu_groups/10/devices/0000:00:1c.0
/sys/kernel/iommu_groups/0/devices/0000:00:02.0
/sys/kernel/iommu_groups/19/devices/0000:06:01.0
/sys/kernel/iommu_groups/9/devices/0000:00:1b.0

浙公網安備 33010602011771號