kvm 基本操作

1、查看 虚拟机信息

virsh dominfo centos_test1

2、查看正在运行的虚拟机

virsh list       /          virsh list --all    #所有虚拟机

3、编辑虚拟机配置

virsh edit centos7_template

4、查看虚拟机磁盘信息

qemu-img info centos7_template.qcow2 

5、虚拟机磁盘扩容

qemu-img resize centos7_template.qcow2 +60G

若出错:Can't get refcount for cluster 88552: Invalid argument

执行 qemu-img check -r all centos7_test4.qcow2 

 6、kvm 克隆服务器

virt-clone -o centos7_test1 -n centos7_test2 -f /home/vncuser/vir-machine/disk/centos_test2/centos7_test2.qcow2

说明:

  -o centos7_test1  模板名称   

  -n centos7_test2  新虚拟机名称

  -f /home/vncuser/vir-machine/disk/centos_test2/centos7_test2.qcow2  新虚拟机磁盘文件存储路径

修改配置后根据文件重新创建虚拟机

  virsh create /etc/libvirt/qemu/centos7_aotumeter.xml

posted @ 2021-11-23 16:57  蒲公英PGY  阅读(80)  评论(0编辑  收藏  举报