Manage KVM QEMU virtual machines with virt
VM Operations
List all
sh
sudo virsh list --allStart machine
sh
sudo virsh start debian12Edit machine
sh
sudo virsh edit debian12Power off machine
sh
sudo virsh shutdown debian12Force shut power off
sh
sudo virsh destroy debian12Clone machine
sh
virt-clone --original debian12 --name debian12-copy --file /var/lib/libvirt/images/debian12-copy.qcow2Network
List
sh
sudo virsh net-list --allStart network, must be done before the VM can start
sh
sudo virsh net-start defaultNetwork info
sh
virsh net-info defaultGet VMs IP addresses
sh
virsh net-dhcp-leases defaultArticle on how to set up networks in KVM
Mount disk shared with host
This is in virt manager gui
- Set up shared memory
- Press "Add hardware", select "Filesystem"
- Select the host folder, and add a name for Target path like this "mount_tag_ssd1"
Typical error message: Unable to find a satisfying virtiofsd
Add the path inside the xml right under driver tag:
xml
<binary path="/run/current-system/sw/bin/virtiofsd"/>Inside the host you mount it like this
sh
#virtiofs
mount_tag_ssd1 /mnt/ssd1 virtiofs rw,relatime 0 0