创建一个虚拟机用于练习在线扩容 virt-install --name centos8-3 --memory 4096,currentMemory=1024 --vcpus 2,maxvcpus=8 virtio,format=qcow2 --import --os-variant rhel8.0 --graphics vnc --network network=default --name centos8 =65536 lazy_refcounts=off refcount_bits=16 b、扩容虚拟机磁盘 [root@zutuanxue ~]# virsh attach-disk --domain centos8 再次添加,--config 下次启动才会生效 [root@zutuanxue ~]# virsh attach-disk --domain centos8-3 --source /var/lib/libvirt -3 --target vdb 成功分离磁盘 永久剥离 [root@zutuanxue ~]# virsh detach-disk --domain centos8-3 --target vdb
---------------------------------------------- 6 rhel8-clone running - centos8
关机,备份模板机硬盘 生成模板硬盘,保存,用于后续可以复制出来N多个这样的硬盘,让虚拟机直接导入使用 根据模板机生成虚拟机 复制模板硬盘 创建虚拟机,导入硬盘 virt-install --name centos8