最新消息:本站原qzkyl域名已转让,后期该域名所有言论与本站无关,同时本站已改名ipve虚拟机,交换友链请发送邮件zc#ipve.cn(#换@)

PVE虚拟机常见问题处理(持续更新)

VMware/PVE ipve 158浏览 0评论

一、硬盘直通

硬盘直通可以把整个一块硬盘提供给虚拟机使用(如果不这么做,往往是在物理硬盘上创建一个虚拟硬盘文件,提供给虚拟机用)。硬盘直通可以让虚拟机更直接地使用硬盘,对于nas等场景通常使用直通。
然而网上很多所谓的pve硬盘直通其实是磁盘映射。
硬盘映射网上有很多文档,不再赘述。记录/dev/disk/disk下的信息,然后通过qm set 100 -sata1 /dev/disk/by-id/ata-WDC_XXXX_XXXX_XXXX设置那个就是。
真正直通往往是将硬盘控制器直通,这样虚拟机对硬盘的控制才是完整的。方法为在图形界面中使用pci passthrough,直通sas卡或者板载sata控制器。

二、使用命令停止虚拟机

如下111为你自己VM ID为例 执行 qm stop 111

三、PVE开启嵌套虚拟化

检测pve虚拟系统是否支持虚拟化
PVE虚拟出来的vm系统的cpu,默认不支持vmx,即不支持嵌套虚拟化,在虚拟机中使用命令来验证:
# egrep –color ‘vmx|svm’ /proc/cpuinfo
没有输出即不支持,否则会高亮显示vmx或者svm。
有时为了测试和学习,需要开启pve的嵌套虚拟化,以便能在其系统中安装类似esxi,hyper-v之类的虚拟化软件,就需要开启pve的嵌套虚拟化功能了。

四、修复PVE记录时间问题

1. 可能是ntp服务器没连上,默认是debian的ntp。可以修改下。
nano /etc/systemd/timesyncd.conf
把里边的‘#NTP=’注释去掉,=后边加上国内的ntp服务器地址。比如cn.ntp.org.cn,cn.pool.ntp.org之类有很多。之后保存。
重启服务 systemctl restart systemd-timesyncd 查看状态 systemctl status systemd-timesyncd
2. 删掉/var/lib/rrdcached/db 里边的所有文件夹;这里是系统图表缓存文件,删了系统会自动重建新的

五、虚拟硬盘的操作

下面讲个利用命令行完成的稍高级的操作:借助Linux的工具非常方便地操作虚拟磁盘。
比如openwrt不是通过iso文件安装系统,而是下载得到的就是raw磁盘文件。这时可以通过形如dd if=openwrt.img of=/dev/mapper/pve-vm-xx来直接写入,即完成安装,不需要工具转换、导入等。
还可以还可以通过kpartx和mount,把虚拟磁盘挂载到宿主机下从而读写其中的文件。

六、更换软件源

pve默认配置的是需要付费的企业源,需要配置成免费源。
此外,如果服务器在国内,我们需要更换为清华大学开源软件镜像站(TUNA)的pve和Debian源。
在shell中(web界面即有shell,如果不会操作shell随便找找入门教程)
注释掉/etc/apt/sources.list.d/pve-enterprise.list中的内容,或者删除这个文件。

rm -f /etc/apt/sources.list.d/pve-install-repo.list

通过命令

echo "https://mirrors.tuna.tsinghua.edu.cn/proxmox/debian buster pve-no-subscription" > /etc/apt/sources.list.d/pve-no-subscription.list
# OR
echo "deb http://download.proxmox.com/debian/pve bullseye pve-no-subscription" > /etc/apt/sources.list.d/pve-no-subscription.list

通过命令添加TUNA的pve免费源

echo "# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ buster main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-updates main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-updates main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-backports main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-backports main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates main contrib non-free" > /etc/apt/sources.list

发表我的评论
取消评论
表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址