• 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. lvcreate/lvremove Failed with Error “Can’t remove merging snapshot logical volume”
  2. What’s different between /bin/false and /sbin/nologin as nologin user’s shell
  3. Understanding linux parted utility
  4. mailstat Command Examples in Linux
  5. How to Create a New /boot Partition in CentOS / RHEL
  6. How to Check if a Service Restart or Server Reboot is required After RPM Package Update (CentOS/RHEL/Fedora)
  7. How to Disable “alt+ctrl+Del” Key Combination causing reboot in CentOS/RHEL 4,5
  8. RHEL 7 – RHCSA Notes (Cheat Sheets)
  9. CentOS / RHEL 7 : How to boot into Rescue Mode or Emergency Mode
  10. How to enable core dump for Applications on CentOS/RHEL

You May Also Like

Primary Sidebar

Recent Posts

  • qemu-system-x86_64: command not found
  • timedatectl: command not found
  • mpirun.openmpi: command not found
  • startkde: command not found

© 2022 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright