Monday, April 30, 2012

KVM commands

To install with prompt
virt-install --prompt


List virtual machine
virsh list


Stop virtual machine
virsh destroy 


Configure VM autostart
virsh autostart 


Unconfigure VM autostart
virsh autostart --disable 


To install using kickstart
virt-install --name=rhel03.localdomain -r 768 --disk path=/var/lib/libvirt/images/rhel03.localdomain.img,size=8 -l http://192.168.122.1/pub/inst -x "ks=http://192.168.122.1/pub/ks/rhel03.cfg"


To create VM snapshot
virsh save centos01 centos01.snap.$(date +%y%m%d)


To restore VM snapshot
virsh shutdown centos01
virsh restore centos01.snap


Clone vm
virt-clone --original centos01 --name centos02 --file /home/penoycentral/images/centos02.img


Troubleshooting KVM

Error when starting the VM snapshot
error restoring domain unable to read from monitor


To fix
virsh managedsave-remove domain-name

No comments: