先把磁盘镜像上传到pve里
使用qm importdisk命令导入
qm importdisk <vmid> <images-name> <storage pool> --format=<disk-fs>
vmid:vm的id 例如102
images-name:磁盘镜像的名字
storage pool: 存储磁盘镜像的位置,如lvm-thin local
disk-fs: 磁盘镜像格式 raw/vmdk/qcow2
代码演示:
qm importdisk 102 ubuntu-18.04.vmdk NVME --format=qcow2
importing disk 'ubuntu-18.04.vmdk' to VM 102 ...
Formatting '/nvme/images/102/vm-102-disk-1.qcow2', fmt=qcow2 size=10737418240 cluster_size=65536 preallocation=metadata lazy_refcounts=off refcount_bits=16
transferred: 0 bytes remaining: 10737418240 bytes total: 10737418240 bytes progression: 0.00 %
......
transferred: 10737418240 bytes remaining: 0 bytes total: 10737418240 bytes progression: 100.00 %
Successfully imported disk as 'unused1:NVME:102/vm-102-disk-1.qcow2'
此时,pve面板出现未使用磁盘。
这里双击 这个未使用磁盘。然后这是总线、设备,接着点击添加
此时就有了
第二种方法如果是要导入一个系统盘一个数据盘,是要分开导入两次吗?可以同时导入两个吗?具体命令是什么啊,我直接在第一个。第一种方法那个你的路径是/nvme/image/xxx,那命令的时候怎么是nvme:xxx了。我导入的路径是/home/data/ip/xxx.raw ,显示我有非法字符,我就有个- 和_,还有ip的小数点和数字