Centos 6.5 | Renaming Virtual Machines

I’ve been playing about with virtual machines for a bit, using a mixture of CentOS 6.5 as the host, and Fedora on my laptop to set up the guests.  I’ve been using virt-manager which is an easy tool.  But oops this morning I created a virtual machine which I didn’t spell right.  I don’t seem to be able to rename it virt-manager.  Well it’s not that simple, but once you know how, it’s not that hard at all.

  • Shutdown the machine you want to rename
virsh shutdown machine1 or virsh destroy machine1
  • Use virsh dump to dump the virtual machines xml to the new name
virsh dump machine1 > machine2.xml
  • The xml files are in the location /etc/libvirt/qemu, so edit /etc/libvirt/qemu/machine2.xml
  • Find this
<domain type='kvm'>

  • Replace machine1 with machine2, save the file.
  • Undefine the old machine
virsh undefine machine1
  • Now you can define the new machine and boot it
virsh define machine2.xml





Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s