一、开启IO-MMU和启用SR-IOV

1. 修改grub文件

bash

nano /etc/default/grub

GRUB_CMDLINE_LINUX_DEFAULT项末尾添加以下内容:

text

quiet intel_iommu=on pci=assign-busses pcie_acs_override=downstream video=efifb:off,vesafb:off,simplefb:off iommu=pt

参数说明:

  • intel_iommu=on:开启Intel平台的IOMMU(AMD平台使用amd_iommu=on

  • iommu=pt:passthrough模式,可提高性能

  • pcie_acs_override=downstream:将同一Group中的设备分开直通

  • video=efifb:off:禁用efifb驱动,防止BAR 3内存保留错误

  • pci=assign-bussesiommu=pt:开启SR-IOV所需参数

更新grub配置:

bash

update-grub

2. 加载直通内核模块

bash

nano /etc/modules

添加以下模块:

text

vfio
vfio_iommu_type1
vfio_pci
vfio_virqfd

3. 重启并查看参数

查看所有网卡:

bash

lspci -nn|grep Eth

text

03:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller [10ec:8168] (rev 06)
0b:00.0 Ethernet controller [0200]: Qualcomm Atheros Killer E220x Gigabit Ethernet Controller [1969:e091] (rev 10)
0c:00.0 Ethernet controller [0200]: Intel Corporation 82599ES 10-Gigabit SFI/SFP+ Network Connection [8086:10fb] (rev 01)

查看网卡信息:

bash

lshw -c network -businfo

text

Bus info          Device           Class          Description
=============================================================
pci@0000:03:00.0                   network        RTL8111/8168/8411 PCI Express Gig
pci@0000:0b:00.0  enp11s0          network        Killer E220x Gigabit Ethernet Con
pci@0000:0c:00.0  enp5s0f0f0       network        82599ES 10-Gigabit SFI/SFP+ Netwo
usb@2:6           enx000ec6711984  network        Ethernet interface
                  vmbr0            network        Ethernet interface
                  ztnfag5sip       network        Ethernet interface
                  tap888i0         network        Ethernet interface

查看SR-IOV开启状态:

bash

lspci -s 05:00.0 -vvv | grep Capabilities

text

pcilib: sysfs_read_vpd: read failed: Input/output error
        Capabilities: [40] Power Management version 3
        Capabilities: [50] MSI: Enable- Count=1/1 Maskable+ 64bit+
        Capabilities: [70] MSI-X: Enable+ Count=64 Masked-
        Capabilities: [a0] Express (v2) Endpoint, MSI 00
        Capabilities: [e0] Vital Product Data
        Capabilities: [100 v1] Advanced Error Reporting
        Capabilities: [140 v1] Device Serial Number 00-1b-21-ff-ff-ba-bf-e6
        Capabilities: [150 v1] Alternative Routing-ID Interpretation (ARI)
        Capabilities: [160 v1] Single Root I/O Virtualization (SR-IOV)

查看网口链路状态:

bash

ethtool enp5s0f0f0

text

Settings for enp5s0f0f0:
        Supported ports: [ FIBRE ]
        Supported link modes:   10000baseT/Full
        Supported pause frame use: Symmetric
        Supports auto-negotiation: No
        Supported FEC modes: Not reported
        Advertised link modes:  10000baseT/Full
        Advertised pause frame use: Symmetric
        Advertised auto-negotiation: No
        Advertised FEC modes: Not reported
        Speed: 10000Mb/s
        Duplex: Full
        Auto-negotiation: off
        Port: FIBRE
        PHYAD: 0
        Transceiver: internal
        Supports Wake-on: d
        Wake-on: d
        Current message level: 0x00000007 (7)
                               drv probe link
        Link detected: yes

查看网卡驱动版本:

bash

ethtool -i enp5s0f0

text

driver: ixgbe
version: 5.13.19-1-pve
firmware-version: 0x00012b2c
expansion-rom-version:
bus-info: 0000:0c:00.0
supports-statistics: yes
supports-test: yes
supports-eeprom-access: yes
supports-register-dump: yes
supports-priv-flags: yes

查看网卡支持的VF数量:

bash

cat /sys/bus/pci/devices/0000:0c:00.0/sriov_totalvfs

text

63

4. 创建开机脚本启用SR-IOV

bash

nano /etc/init.d/net-sriov

脚本内容:

bash

#!/bin/sh

# Copyright (C) 2011, 2012, 2016 Nicira, Inc.
# Licensed under the Apache License, Version 2.0

### BEGIN INIT INFO
# Provides:          openvswitch-switch
# Required-Start:    $network $named $remote_fs $syslog $openvswitch-switch
# Required-Stop:     $remote_fs $openvswitch-switch
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: SR-IOV initialization
# Description:       Initializing VM's network with sriov support
### END INIT INFO

start() {
    # 启用SR-IOV,将enp5s0f0虚拟12个网卡
    echo 12 > /sys/class/net/enp5s0f0/device/sriov_numvfs
    ip link set dev enp5s0f0 up
    
    # 设置VF的MAC地址
    ip link set dev enp5s0f0 vf 0 mac aa:bb:cc:dd:ee:f1
    ip link set dev enp5s0f0 vf 1 mac aa:bb:cc:dd:ee:f2
    ip link set dev enp5s0f0 vf 2 mac aa:bb:cc:dd:ee:f3
    ip link set dev enp5s0f0 vf 3 mac aa:bb:cc:dd:ee:f4
    ip link set dev enp5s0f0 vf 4 mac aa:bb:cc:dd:ee:f5
    ip link set dev enp5s0f0 vf 5 mac aa:bb:cc:dd:ee:f6
    ip link set dev enp5s0f0 vf 6 mac aa:bb:cc:dd:ee:f7
    ip link set dev enp5s0f0 vf 7 mac aa:bb:cc:dd:ee:f8
    ip link set dev enp5s0f0 vf 8 mac aa:bb:cc:dd:ee:f9
    ip link set dev enp5s0f0 vf 9 mac aa:bb:cc:dd:ee:a0
    ip link set dev enp5s0f0 vf 10 mac aa:bb:cc:dd:ee:a1
    ip link set dev enp5s0f0 vf 11 mac aa:bb:cc:dd:ee:a2
    
    # 初始化网络
    systemctl restart networking
}

stop() {
    [ "$READ_INTERFACES" != "no" ] && network_interfaces ifdown
    ovs_ctl stop
}

case $1 in
    start)
        start
        ;;
    stop|force-stop)
        stop
        ;;
    *)
        echo "Usage: $0 {start|stop}" >&2
        exit 1
        ;;
esac

exit 0

5. 启用SR-IOV脚本

bash

chmod +x /etc/init.d/net-sriov
systemctl enable net-sriov

6. 重启PVE

bash

reboot

重启后检查网络界面是否出现多个网卡,验证MAC地址设置:

bash

ip a

二、显卡直通

1. 修改grub文件

bash

nano /etc/default/grub

添加:

text

video=efifb:off,vesafb:off,simplefb:off

更新grub:

bash

update-grub

2. 加载直通内核模块

bash

nano /etc/modules

添加:

text

vfio
vfio_iommu_type1
vfio_pci
vfio_virqfd

3. 屏蔽显卡驱动

Intel核显:

bash

echo "blacklist snd_hda_intel" >> /etc/modprobe.d/pve-blacklist.conf
echo "blacklist snd_hda_codec_hdmi" >> /etc/modprobe.d/pve-blacklist.conf
echo "blacklist i915" >> /etc/modprobe.d/pve-blacklist.conf

AMD显卡:

bash

echo "blacklist radeon" >> /etc/modprobe.d/pve-blacklist.conf
echo "blacklist amdgpu" >> /etc/modprobe.d/pve-blacklist.conf

NVIDIA显卡:

bash

echo "blacklist nouveau" >> /etc/modprobe.d/pve-blacklist.conf
echo "blacklist nvidia" >> /etc/modprobe.d/pve-blacklist.conf 
echo "blacklist nvidiafb" >> /etc/modprobe.d/pve-blacklist.conf

N卡额外配置:

bash

echo "options kvm ignore_msrs=1" > /etc/modprobe.d/kvm.conf

4. 更新内核并重启

bash

update-initramfs -k all -u
reboot

5. 检查模块加载

bash

lsmod | grep vfio

text

root@home:~# lsmod | grep vfio
vfio_pci               57344  0
vfio_virqfd            16384  1 vfio_pci
irqbypass              16384  2 vfio_pci,kvm
vfio_iommu_type1       36864  0
vfio                   36864  2 vfio_iommu_type1,vfio_pci

6. 绑定显卡到vfio-pci

查看PCI设备:

bash

lspci

text

root@home:~# lspci 
00:00.0 Host bridge: Intel Corporation Device 9b33 (rev 01)
00:01.0 PCI bridge: Intel Corporation 6th-10th Gen Core Processor PCIe Controller (x16) (rev 01)
00:02.0 VGA compatible controller: Intel Corporation CometLake-S GT2 [UHD Graphics 630] (rev 05)              #核显 00:02.0
00:14.0 USB controller: Intel Corporation Comet Lake PCH-V USB Controller
00:16.0 Communication controller: Intel Corporation Device a3ba
00:17.0 SATA controller: Intel Corporation 400 Series Chipset Family SATA AHCI Controller
00:1b.0 PCI bridge: Intel Corporation Device a3e9 (rev f0)
00:1c.0 PCI bridge: Intel Corporation Device a392 (rev f0)
00:1c.3 PCI bridge: Intel Corporation Device a393 (rev f0)
00:1c.4 PCI bridge: Intel Corporation Device a394 (rev f0)
00:1d.0 PCI bridge: Intel Corporation Device a398 (rev f0)
00:1f.0 ISA bridge: Intel Corporation Device a3c8
00:1f.2 Memory controller: Intel Corporation Memory controller
00:1f.3 Audio device: Intel Corporation Device a3f0                                                  #板载声卡 00:1f.3
00:1f.4 SMBus: Intel Corporation Comet Lake PCH-V SMBus Host Controller
01:00.0 VGA compatible controller: NVIDIA Corporation GK208B [GeForce GT 730] (rev a1)                       #独显 01:00.0
01:00.1 Audio device: NVIDIA Corporation GK208 HDMI/DP Audio Controller (rev a1)                            #独显声卡 01:00.1
04:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8125 2.5GbE Controller (rev 05)
05:00.0 Ethernet controller: Intel Corporation Ethernet Controller 10-Gigabit X540-AT2 (rev 01)
05:00.1 Ethernet controller: Intel Corporation Ethernet Controller 10-Gigabit X540-AT2 (rev 01)
05:10.0 Ethernet controller: Intel Corporation X540 Ethernet Controller Virtual Function (rev 01)
05:10.2 Ethernet controller: Intel Corporation X540 Ethernet Controller Virtual Function (rev 01)
05:10.4 Ethernet controller: Intel Corporation X540 Ethernet Controller Virtual Function (rev 01)
05:10.6 Ethernet controller: Intel Corporation X540 Ethernet Controller Virtual Function (rev 01)
05:11.0 Ethernet controller: Intel Corporation X540 Ethernet Controller Virtual Function (rev 01)
05:11.2 Ethernet controller: Intel Corporation X540 Ethernet Controller Virtual Function (rev 01)
05:11.4 Ethernet controller: Intel Corporation X540 Ethernet Controller Virtual Function (rev 01)
05:11.6 Ethernet controller: Intel Corporation X540 Ethernet Controller Virtual Function (rev 01)
05:12.0 Ethernet controller: Intel Corporation X540 Ethernet Controller Virtual Function (rev 01)
05:12.2 Ethernet controller: Intel Corporation X540 Ethernet Controller Virtual Function (rev 01)
05:12.4 Ethernet controller: Intel Corporation X540 Ethernet Controller Virtual Function (rev 01)
05:12.6 Ethernet controller: Intel Corporation X540 Ethernet Controller Virtual Function (rev 01)
06:00.0 Non-Volatile memory controller: KIOXIA Corporation Device 0008 (rev 01)

bash

lspci -n

text

root@home:~# lspci -n 
00:00.0 0600: 8086:9b33 (rev 01)
00:01.0 0604: 8086:1901 (rev 01)
00:02.0 0300: 8086:9bc5 (rev 05)                                     #核显 8086:9bc5
00:14.0 0c03: 8086:a3af
00:16.0 0780: 8086:a3ba
00:17.0 0106: 8086:a382
00:1b.0 0604: 8086:a3e9 (rev f0)
00:1c.0 0604: 8086:a392 (rev f0)
00:1c.3 0604: 8086:a393 (rev f0)
00:1c.4 0604: 8086:a394 (rev f0)
00:1d.0 0604: 8086:a398 (rev f0)
00:1f.0 0601: 8086:a3c8
00:1f.2 0580: 8086:a3a1
00:1f.3 0403: 8086:a3f0                                                     #板载声卡 8086:a3f0
00:1f.4 0c05: 8086:a3a3
01:00.0 0300: 10de:1f82 (rev a1)                                    #独显 10de:1f82
01:00.1 0403: 10de:10fa (rev a1)                                    #独显声卡 10de:10fa
04:00.0 0200: 10ec:8125 (rev 05)
05:00.0 0200: 8086:1528 (rev 01)
05:00.1 0200: 8086:1528 (rev 01)
05:10.0 0200: 8086:1515 (rev 01)
05:10.2 0200: 8086:1515 (rev 01)
05:10.4 0200: 8086:1515 (rev 01)
05:10.6 0200: 8086:1515 (rev 01)
05:11.0 0200: 8086:1515 (rev 01)
05:11.2 0200: 8086:1515 (rev 01)
05:11.4 0200: 8086:1515 (rev 01)
05:11.6 0200: 8086:1515 (rev 01)
05:12.0 0200: 8086:1515 (rev 01)
05:12.2 0200: 8086:1515 (rev 01)
05:12.4 0200: 8086:1515 (rev 01)
05:12.6 0200: 8086:1515 (rev 01)
06:00.0 0108: 1e0f:0008 (rev 01)

绑定设备:

bash

echo "options vfio-pci ids=1e0f:0008,8086:9bc5,8086:a3f0,10de:1f82,10de:10fa disable_vga=1" > /etc/modprobe.d/vfio.conf

如果无法输出到外接显示器,取消disable_vga=1参数:

bash

echo "options vfio-pci ids=1e0f:0008,8086:9bc5,8086:a3f0,10de:1f82,10de:10fa" > /etc/modprobe.d/vfio.conf

7. 验证配置

bash

cat /etc/modprobe.d/pve-blacklist.conf
cat /etc/modprobe.d/vfio.conf

刷新配置:

bash

update-grub
update-initramfs -k all -u
reboot

检查配置是否成功:

bash

lspci -nnk

text

root@home:~# lspci -nnk
00:00.0 Host bridge [0600]: Intel Corporation Device [8086:9b33] (rev 01)
              DeviceName: Onboard - Other
            Subsystem: ASUSTeK Computer Inc. Device [1043:8694]
              Kernel driver in use: skl_uncore
00:01.0 PCI bridge [0604]: Intel Corporation 6th-10th Gen Core Processor PCIe Controller (x16) [8086:1901] (rev 01)
            Kernel driver in use: pcieport
00:02.0 VGA compatible controller [0300]: Intel Corporation CometLake-S GT2 [UHD Graphics 630] [8086:9bc5] (rev 05)
            DeviceName: Onboard - Video
            Subsystem: ASUSTeK Computer Inc. Device [1043:8694]
            Kernel driver in use: vfio-pci
            Kernel modules: i915

8. 设置虚拟机配置

编辑虚拟机配置文件:

bash

nano /etc/pve/qemu-server/100.conf

添加:

text

args: -cpu host,kvm=off,hv_time,hv_relaxed,hv_vapic,hv_spinlocks=0x1fff,hv_vendor_id=NV43FIX

注意: 安装完独显驱动后需手动禁用默认集显,否则不会默认使用独显。

三、安装破解内核解决IOMMU分组问题

1. 下载破解内核

yfdoor/PVE-Kernel 下载破解内核。(如需新版本内核6.11.0-2可联系我)

2. 安装内核

进入内核文件目录:

bash

cd pve-kernel-5.13.18-1/
dpkg -i *.deb

text

root@pve2:~/PVE-Kernel/pve-kernel-5.13.18-1# dpkg -i *.deb
(Reading database ... 180164 files and directories currently installed.)
Preparing to unpack linux-tools-5.13_5.13.18-1_amd64.deb ...
Unpacking linux-tools-5.13 (5.13.18-1) over (5.13.14-1) ...
Preparing to unpack linux-tools-5.13-dbgsym_5.13.18-1_amd64.ddeb ...
Unpacking linux-tools-5.13-dbgsym (5.13.18-1) over (5.13.14-1) ...
Preparing to unpack pve-headers-5.13.18-1-pve_5.13.18-1_amd64.deb ...
Unpacking pve-headers-5.13.18-1-pve (5.13.18-1) over (5.13.18-1) ...
Selecting previously unselected package pve-kernel-5.13.18-1-pve.
Preparing to unpack pve-kernel-5.13.18-1-pve_5.13.18-1_amd64.deb ...
Unpacking pve-kernel-5.13.18-1-pve (5.13.18-1) ...
Preparing to unpack pve-kernel-libc-dev_5.13.18-1_amd64.deb ...
Unpacking pve-kernel-libc-dev (5.13.18-1) over (5.13.14-1) ...
Setting up linux-tools-5.13 (5.13.18-1) ...
Setting up linux-tools-5.13-dbgsym (5.13.18-1) ...
Setting up pve-headers-5.13.18-1-pve (5.13.18-1) ...
Setting up pve-kernel-5.13.18-1-pve (5.13.18-1) ...
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 5.13.18-1-pve /boot/vmlinuz-5.13.18-1-pve
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 5.13.18-1-pve /boot/vmlinuz-5.13.18-1-pve
update-initramfs: Generating /boot/initrd.img-5.13.18-1-pve
Running hook script 'zz-proxmox-boot'..
Re-executing '/etc/kernel/postinst.d/zz-proxmox-boot' in new private mount namespace..
No /etc/kernel/proxmox-boot-uuids found, skipping ESP sync.
run-parts: executing /etc/kernel/postinst.d/proxmox-auto-removal 5.13.18-1-pve /boot/vmlinuz-5.13.18-1-pve
run-parts: executing /etc/kernel/postinst.d/zz-proxmox-boot 5.13.18-1-pve /boot/vmlinuz-5.13.18-1-pve
Re-executing '/etc/kernel/postinst.d/zz-proxmox-boot' in new private mount namespace..
No /etc/kernel/proxmox-boot-uuids found, skipping ESP sync.
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 5.13.18-1-pve /boot/vmlinuz-5.13.18-1-pve
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.13.18-1-pve
Found initrd image: /boot/initrd.img-5.13.18-1-pve
Found linux image: /boot/vmlinuz-5.11.22-5-pve
Found initrd image: /boot/initrd.img-5.11.22-5-pve
Found linux image: /boot/vmlinuz-5.4.124-1-pve
Found initrd image: /boot/initrd.img-5.4.124-1-pve
Found linux image: /boot/vmlinuz-5.4.106-1-pve
Found initrd image: /boot/initrd.img-5.4.106-1-pve
Found memtest86+ image: /boot/memtest86+.bin
Found memtest86+ multiboot image: /boot/memtest86+_multiboot.bin
Adding boot menu entry for EFI firmware configuration
done
Setting up pve-kernel-libc-dev (5.13.18-1) ...
Processing triggers for man-db (2.9.4-2) ...

3. 配置内核启动参数

编辑grub文件:

bash

nano /etc/default/grub

设置内核启动顺序:

bash

GRUB_DEFAULT="Advanced options for Proxmox VE GNU/Linux>Proxmox VE GNU/Linux, with Linux 5.13.18-1-pve"

更新配置:

bash

update-grub
update-initramfs -k all -u
reboot

4. 验证IOMMU分组

bash

for d in /sys/kernel/iommu_groups/*/devices/*; do
  n=${d#*/iommu_groups/*}; n=${n%%/*};
  printf 'IOMMU Group %s ' "$n";
  lspci -nns "${d##*/}";
done

text

IOMMU Group 0 00:00.0 Host bridge [0600]: Intel Corporation Device [8086:9b33] (rev 01)
IOMMU Group 10 00:1d.0 PCI bridge [0604]: Intel Corporation Device [8086:a398] (rev f0)
IOMMU Group 11 00:1f.0 ISA bridge [0601]: Intel Corporation Device [8086:a3c8]
IOMMU Group 11 00:1f.2 Memory controller [0580]: Intel Corporation Memory controller [8086:a3a1]
IOMMU Group 11 00:1f.3 Audio device [0403]: Intel Corporation Device [8086:a3f0]
IOMMU Group 11 00:1f.4 SMBus [0c05]: Intel Corporation Comet Lake PCH-V SMBus Host Controller [8086:a3a3]
IOMMU Group 12 01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GK208B [GeForce GT 730] [10de:1287] (rev a1)
IOMMU Group 12 01:00.1 Audio device [0403]: NVIDIA Corporation GK208 HDMI/DP Audio Controller [10de:0e0f] (rev a1)
IOMMU Group 13 04:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL8125 2.5GbE Controller [10ec:8125] (rev 05)
IOMMU Group 14 05:00.0 Ethernet controller [0200]: Intel Corporation Ethernet Controller 10-Gigabit X540-AT2 [8086:1528] (rev 01)
IOMMU Group 15 05:00.1 Ethernet controller [0200]: Intel Corporation Ethernet Controller 10-Gigabit X540-AT2 [8086:1528] (rev 01)
IOMMU Group 16 06:00.0 Non-Volatile memory controller [0108]: KIOXIA Corporation Device [1e0f:0008] (rev 01)
IOMMU Group 17 05:10.0 Ethernet controller [0200]: Intel Corporation X540 Ethernet Controller Virtual Function [8086:1515] (rev 01)
IOMMU Group 18 05:10.2 Ethernet controller [0200]: Intel Corporation X540 Ethernet Controller Virtual Function [8086:1515] (rev 01)
IOMMU Group 19 05:10.4 Ethernet controller [0200]: Intel Corporation X540 Ethernet Controller Virtual Function [8086:1515] (rev 01)
IOMMU Group 1 00:01.0 PCI bridge [0604]: Intel Corporation 6th-10th Gen Core Processor PCIe Controller (x16) [8086:1901] (rev 01)
IOMMU Group 20 05:10.6 Ethernet controller [0200]: Intel Corporation X540 Ethernet Controller Virtual Function [8086:1515] (rev 01)
IOMMU Group 21 05:11.0 Ethernet controller [0200]: Intel Corporation X540 Ethernet Controller Virtual Function [8086:1515] (rev 01)
IOMMU Group 22 05:11.2 Ethernet controller [0200]: Intel Corporation X540 Ethernet Controller Virtual Function [8086:1515] (rev 01)
IOMMU Group 23 05:11.4 Ethernet controller [0200]: Intel Corporation X540 Ethernet Controller Virtual Function [8086:1515] (rev 01)
IOMMU Group 24 05:11.6 Ethernet controller [0200]: Intel Corporation X540 Ethernet Controller Virtual Function [8086:1515] (rev 01)
IOMMU Group 25 05:12.0 Ethernet controller [0200]: Intel Corporation X540 Ethernet Controller Virtual Function [8086:1515] (rev 01)
IOMMU Group 26 05:12.2 Ethernet controller [0200]: Intel Corporation X540 Ethernet Controller Virtual Function [8086:1515] (rev 01)
IOMMU Group 27 05:12.4 Ethernet controller [0200]: Intel Corporation X540 Ethernet Controller Virtual Function [8086:1515] (rev 01)
IOMMU Group 28 05:12.6 Ethernet controller [0200]: Intel Corporation X540 Ethernet Controller Virtual Function [8086:1515] (rev 01)
IOMMU Group 2 00:02.0 VGA compatible controller [0300]: Intel Corporation CometLake-S GT2 [UHD Graphics 630] [8086:9bc5] (rev 05)
IOMMU Group 3 00:14.0 USB controller [0c03]: Intel Corporation Comet Lake PCH-V USB Controller [8086:a3af]
IOMMU Group 4 00:16.0 Communication controller [0780]: Intel Corporation Device [8086:a3ba]
IOMMU Group 5 00:17.0 SATA controller [0106]: Intel Corporation 400 Series Chipset Family SATA AHCI Controller [8086:a382]
IOMMU Group 6 00:1b.0 PCI bridge [0604]: Intel Corporation Device [8086:a3e9] (rev f0)
IOMMU Group 7 00:1c.0 PCI bridge [0604]: Intel Corporation Device [8086:a392] (rev f0)
IOMMU Group 8 00:1c.3 PCI bridge [0604]: Intel Corporation Device [8086:a393] (rev f0)
IOMMU Group 9 00:1c.4 PCI bridge [0604]: Intel Corporation Device [8086:a394] (rev f0)

四、创建Windows 11虚拟机

按照正常流程创建Windows 11虚拟机,安装完成后记得安装独显驱动并禁用默认集显。

五、设置硬盘直通

1. 查看硬盘ID

bash

ls -l /dev/disk/by-id

2. 设置硬盘直通

bash

qm set 100 -sata0 /dev/disk/by-id/nvme-KIOXIA-EXCERIA_PLUS_G2_SSD_21PA22SGK6V3
qm set 100 -sata1 /dev/disk/by-id/ata-WDC_WD10EZEX-08RKKA0_WD-WCC1S6837500

3. 挂载已有分区的物理磁盘

bash

qm set 100 --sata1 /dev/sdb

4. 显示所有磁盘信息

bash

fdisk -ll

5. U盘直通

bash

qm set 109 -usb0 host=13fe:3e00

6. 虚拟磁盘直通挂载

bash

qm importdisk 101 /var/lib/vz/template/iso/****.img local-lvm

text

Successfully imported disk as 'unused0:local-lvm:vm-101-disk-0'

7. 删除直通设备

bash

qm set 101 -delete sata0

六、创建黑群晖

按照黑群晖的正常安装流程进行操作。


注意: 本文所有操作均在Proxmox VE环境下测试通过,具体操作时请根据自身硬件配置进行相应调整。