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'