# List all Virtual Machine. virsh list --all # Start Virtual Machine. virsh start # Shutdown Virtual Machine. virsh shutdown # Reboot Virtual Machine. virsh reboot # Create template Only. qemu-img create -o preallocation=metadata -f qcow2 /var/lib/libvirt/images/debian-10-test.qcow2 20G chown libvirt-qemu:kvm /var/lib/libvirt/images/debian-10-test.qcow2 chmod 600 /var/lib/libvirt/images/debian-10-test.qcow2 # Graphical View. Install with Macvtap virt-install --name=debian-10-test --vcpu=2 --ram=1024 --disk size=20 \ --graphics type=spice --video model.type=virtio,clearxml=yes --sound model=default \ --cdrom=/var/lib/libvirt/images/pool/debian-10.11.0-amd64-netinst.iso \ --network type=direct,source=eno1,source.mode=bridge,model.type=e1000e,address.type=pci # Graphical View install with NAT. virt-install --name=debian-10-test --vcpu=2 --ram=1024 --disk size=20 \ --graphics type=spice --video model.type=virtio,clearxml=yes --sound model=default \ --cdrom=/var/lib/libvirt/images/pool/debian-10.11.0-amd64-netinst.iso # Only Single installation Virtual Machine View. virt-viewer -c qemu+ssh://root@192.168.100.90/system --domain-name vm_name # Resize Virtual Machine Disk. Note: Please shutdown before increase the disk size. 1. virsh list ---------------------- ( List Your VM) 2. virsh shutdown vm_name ------------------ (Select VM to shutdown) 3. virsh domblklist debian11 ------------------ (List Disk Path info of selected VM) 4. qemu-img info /var/lib/libvirt/images/debian11.qcow2 -------------------- (Get Disk Info) 5. qemu-img resize /var/lib/libvirt/images/debian11.qcow2 +20G ------------------ (Resize the disk of VM) 6. cp /var/lib/libvirt/images/debian-11.qcow2 /var/lib/libvirt/images/debian-11-orig.qcow2 7. virt-filesystems --long --parts --blkdevs -h -a /var/lib//libvirt/images/debian-11.qcow2 8. virt-resize --expand /dev/vda1 /var/lib/libvirt/images/debian-11-orig.qcow2 /var/lib/libvirt/images/debian-11.qcow2 9. qemu-img info /var/lib/libvirt/images/debian11.qcow2 -------------------- (Get Disk Info agian) 10. virt-filesystems --long --parts --blkdevs -h -a /var/lib//libvirt/images/debian-11.qcow2 11. virsh start debian11 --------------- (Start the VM) # Increase vcpus. virsh setvcpus debian10 --count 2 --config #Increase memory virsh dominfo debian10 virsh setmaxmem debian10 --size 2097152 --config virsh setmem debian10 --size 2097152 --config Note – Convert the size from gigabyte to kilobyte # Add Network Interface Type - Macvtap virsh attach-interface --domain debian-10-lvm --type direct --source eno1 --model e1000e --config --live Type – NAT virsh attach-interface --domain debian-10-lvm --type network --source default --model virtio --config --live # Clone Virtual Machine virt-clone -o debian-10-test -n debian-10-test-new1 -f /var/lib/libvirt/images/debian-10-test-new1.qcow2 --check all=off --check path_in_use=off --replace