参考软件手册“10.9 PCI(e) Passthrough”
参考https://blog.csdn.net/nasooo/article/details/118105494
此方法不适用于作为显卡使用,只适用于作为运算卡使用
# 开启iommu
# 以下是grub的方式,systemd-boot的方式不一样
# 修改/etc/default/grub
# 在变量GRUB_CMDLINE_LINUX_DEFAULT中增加intel_iommu=on
update-grub
# 加载kernel modules
cat <<EOF >>/etc/modules
vfio
vfio_iommu_type1
vfio_pci
vfio_virqfd
EOF
update-initramfs -u -k all
# 重启
reboot
创建虚拟机后,增加GPU卡
附国内源
apt install apt-transport-https ca-certificates
- Debian源:/etc/apt.sources.list
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free
#deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free
#deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free
#deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free
#deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free
- PVE源:/etc/apt/sources.list.d/pve-enterprise.list
deb https://mirrors.tuna.tsinghua.edu.cn/proxmox/debian bullseye pve-no-subscription
- LXC源:/usr/share/perl5/PVE/APLInfo.pm
sed -i 's|http://download.proxmox.com|https://mirrors.tuna.tsinghua.edu.cn/proxmox|g' /usr/share/perl5/PVE/APLInfo.pm
# sed -i "s#http://download.proxmox.com/images#https://mirrors.ustc.edu.cn/proxmox/images#g" /usr/share/perl5/PVE/APLInfo.pm
systemctl restart pvedaemon.service
VM迁移
- 在GUI上对需要迁移的VM进行“备份”,备份目录一般在/var/lib/vz/dump中,类似
vzdump-qemu-101-2020_11_14-19_31_53.vma.zst
- 把备份文件拷贝到需要导入的PVE服务器中
- 执行命令:
qmrestore file id
,注意id不要和已有的冲突
增加硬盘
- 硬盘做好分区、格式化
- 在节点->硬盘->LVM-Thin中,选择“Create Thinpool”
- 在数据中心->存储中,选择添加LVM-Thin
如果是需要扩展系统自带的LVM-Thin(data):
- 硬盘做好分区、格式化
- 使用pvcreate创建PV
- 使用vgextend把PV加入到已有的VG(pve)中
- 使用lvextend扩展逻辑卷大小
- 使用xfs_growfs或者resize2fs是增加的容量生效