• 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. Understanding The /etc/sysconfig Directory
  2. CentOS / RHEL : Beginners guide to vsftpd (installation and configuration)
  3. Features of the “Btrfs” Filesystem
  4. Beginners Guide to SELinux
  5. How to configure NTP server and client in CentOS / RHEL 7
  6. How to install and configure Samba in CentOS / RHEL
  7. How to configure LDAP Client on CentOS/RHEL 6 using SSSD
  8. How to Check the Size og yum Channels in CentOS/RHEL
  9. CentOS / RHEL : How to configure a user account to never expire (disable password ageing)
  10. mdadm Command Shows State : active, degraded

You May Also Like

Primary Sidebar

Recent Posts

  • How to set the default character set in MySQL and how to propagate it in a master-master replication scenario
  • “Connection reset by peer” – error while ssh into a CentOS/RHEL system with a specific user only
  • MySQL: how to figure out which session holds which table level or global read locks
  • Recommended Configuration of the MySQL Performance Schema
  • Archives
  • Contact Us
  • Copyright

© 2021 · The Geek Diary