首页 » 折腾 » 正文

windows server2022 使用记录

安装hypyer-v

# powershell
Add-WindowsFeature Hyper-V,Hyper-V-Tools,Hyper-V-PowerShell -IncludeManagementTools
Restart-Computer -Force

创建虚拟机及虚拟交换机过程略

PCIE直通虚拟机

参考 https://www.licc.tech/article?id=35

先禁用相关PCIE设备

复制PCIE路径信息,如下图则是PCIROOT(0)#PCI(1C04)#PCI(0000)

然后powershell运行(需替换PCIE设备路径及虚拟机名称)

# 设置虚拟机关机时自动关机
Set-VM -Name openwrt -AutomaticStopAction TurnOff

# 从主机断开PCI设备
Dismount-VMHostAssignableDevice -LocationPath "PCIROOT(0)#PCI(1C04)#PCI(0000)" -Force
# 将PCI设备分配给虚拟机 openwrt
Add-VMAssignableDevice -LocationPath "PCIROOT(0)#PCI(1C04)#PCI(0000)" -VMName "openwrt"

# 查看是否挂载成功
Get-VMAssignableDevice -VMName openwrt

如果要挂载回host

Remove-VMAssignableDevice -LocationPath "PCIROOT(0)#PCI(1C04)#PCI(0000)" -VMName "openwrt"

Mount-VMHostAssignableDevice -LocationPath "PCIROOT(0)#PCI(1C04)#PCI(0000)"

发表评论