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

The Geek Diary

CONCEPTS | BASICS | HOWTO

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

How to rename a KVM VM with virsh

By admin

The syntax is to rename a KVM VM with virsh is as follows:

# virsh domrename {domain} {new-name}

Let’s see an example of renaming a VM using virsh.

1. To rename VM from serverA to serverB, first shutdown the VM:

# virsh shutdown serverA

2. Now to rename a VM, run:

# virsh domrename serverA serverB
Domain successfully renamed

3. To start the VM/domain:

# virsh start serverB

Rename KVM domain with virsh and XML

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

# virsh dumpxml serverA > serverB.xml

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

# vi serverB.xml

Update it as follows from serverA to serverB:
<name>serverB</name>

3. Shutdown the serverA domain/vm:

# virsh shutdown serverA

4. You need to undefine the old VM name:

# virsh undefine serverA

5. Finally, import the edited XML file to define the VM serverB:

# virsh define serverB.xml

6. Start the domain serverB, enter:

# virsh start serverB

Filed Under: CentOS/RHEL, Linux, Oracle Linux

Some more articles you might also be interested in …

  1. “iscsiadm” Discovery TimeOut With Two Or More Network Interfaces in CentOS/RHEL
  2. Understanding the rc Scripts in Linux
  3. CentOS / RHEL : How to configure vsftpd to use ports other than the default ports 20 and 21
  4. Creating and Removing Files and Directories Under Linux
  5. How to configure kdump in Oracle Enterprise Linux (OEL 5,6)
  6. How to Check if a Service Restart or Server Reboot is required After RPM Package Update (CentOS/RHEL/Fedora)
  7. How to monitor /etc/shadow and /etc/passwd file for changes with Auditd?
  8. Using iostat to monitor system performance in Linux (Examples included)
  9. How to view linux disk partitions (partition table)
  10. How To Separate Each Of Syslog Client’s Messages Into Different File (CentOS/RHEL 6 and 7)

You May Also Like

Primary Sidebar

Recent Posts

  • How to Disable IPv6 on Ubuntu 18.04 Bionic Beaver Linux
  • How to Capture More Logs in /var/log/dmesg for CentOS/RHEL
  • Unable to Start RDMA Services on CentOS/RHEL 7
  • How to rename a KVM VM with virsh
  • Archives
  • Contact Us
  • Copyright

© 2021 · The Geek Diary