Project

General

Profile

KVM Commands Reference

User documentation
12/20/2017

  • Last Updated: 08/10/2018

Creating VMs

To define VM from xml configuration:

root@labsrv1 16:20:46 
 > ~ # virsh define <path_to_xml_file>

To edit a VM configuration:

root@labsrv1 16:20:46 
 > ~ # virsh edit <name of VM>

To clone a virtual machine (provided that the virtual machine is shutdown):

root@labsrv1 22:24:20 
 > ~ # virt-clone -o <old_vm_name> -n <new_vm_name> -f <new_vm_image_path>

Example:

root@labsrv1 22:24:20 
 > ~ # virt-clone -o spoke1 -n spoke2 -f /data/spoke2.img

Managing VMs

To start a virtual machine:

root@labsrv1 16:20:46 
 > ~ # virsh start <vm_name>

To cut off power to a virtual machine:

root@labsrv1 16:20:46 
 > ~ # virsh destroy <vm_name>

To access the console of a virtual machine:

root@labsrv1 16:20:46 
 > ~ # virsh console <vm_name>

To exit the console of a virtual machine:

Ctrl+]

Files