Renaming a KVM virtual machine

Source: Internet
Author: User

1. View all KVM virtual machines

2. Renaming a KVM virtual machine is best to shut down the virtual machine before exporting its XML file

[[Email PROTECTED]_KVM ~]# cd/etc/libvirt/qemu[[email protected]_kvm qemu]# virsh dumpxml  > Kvm_00.xml

3, in order to let the renamed virtual machine name and disk file name consistent, we can first name the previous disk file to Kvm_00.img

[Email PROTECTED]_KVM ~]# cd/var/lib/libvirt/mv kvm_client00.img kvm_00.img        // Renaming a virtual machine disk file name

4. edit Kvm_00.xml file, modify <name> tag pair and disk File , here we change the disk file into kvm_00.img

<domain type='KVM'> <name>kvm_00</name>      ......     ... The omission of .....<disk type='file'Device='Disk'> <driver name='Qemu'Type='Raw'Cache='None'/> <sourcefile='/var/lib/libvirt/images/kvm_00.img'/>

5. Use the Virsh undefine command to delete the previous virtual machine and define a new KVM virtual machine based on the new XML file

[[Email PROTECTED]_KVM ~]# virsh undefine kvm_client00                // Delete kvm_client00 virtual machine [email protected]_ KVM ~]# virsh define/etc/libvirt/qemukvm_00.xml   // redefine a new KVM virtual machine

6. Finally we can use the Virsh List--all command again to view the results as follows:

The KVM machine, renamed as above, can be started directly, without affecting the files of the Udev dynamic management device. Compared to the previous virtual machine, just the name changed.

Respect for the work of others reproduced please be sure to indicate the source: http://www.cnblogs.com/5201351/p/4464350.html

Renaming a KVM virtual machine

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.