• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to Rename KVM VM with virsh

by admin

The syntax to rename a KVM VM with virsh is:

# virsh domrename {domain} {new-name}

1. To rename VM from Production-A to Production-B, first shutdown the VM Production-A:

# virsh shutdown Production-A

2. Now rename the VM, using below command:

# virsh domrename Production-A Production-B
Domain successfully renamed

3. Start the VM/domain, once the rename is completed successfully:

# virsh start Production-B

Rename KVM domain with virsh and XML

1. First get domain information in XML and save it to a new file:

# virsh dumpxml Production-A > Production-B.xml

2. Edit the XML file and change the name between the <name></name>

# vi Production-B.xml

3. Update it as follows from Production-A to Production-B:

<name>Production-B</name>

4. Shutdown the Production-A domain/vm:

# virsh shutdown Production-A

5. You need to undefine the old VM name:

# virsh undefine Production-A

6. Finally, import the edited XML file to define the VM Production-B:

# virsh define Production-B.xml

7. Start the domain Production-B, enter:

# virsh start Production-B

Filed Under: Linux, RHV

Some more articles you might also be interested in …

  1. How to configure LDAP Client on CentOS/RHEL 6 using SSSD
  2. feedreader Command Examples in Linux
  3. CentOS / RHEL : How to configure iptable rules to allow FTP ports 20/21
  4. Linux OS Service ‘xendomains’
  5. sesearch: command not found
  6. lvm: command not found
  7. 10 useful cron examples to schedule jobs in Linux
  8. CentOS / RHEL 6 : How to Change the Volume Group Name for Root Disk Device
  9. How to configure postifx smtp relay in CentOS/RHEL 5 and 6
  10. dstat: command not found

You May Also Like

Primary Sidebar

Recent Posts

  • ncat Command Examples in Linux
  • ncat: command not found
  • nautilus Command Examples in Linux
  • namei: command not found

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright