Kvm vm rename and logical volume rename
wordpress meta
title: 'KVM VM Rename and Logical Volume Rename'
date: '2012-11-06T01:20:53-06:00'
status: publish
permalink: /kvm-vm-rename-and-logical-volume-rename
author: admin
excerpt: ''
type: post
id: 25
category:
- KVM
- LVM
tag: []
post_format: []
title: 'KVM VM Rename and Logical Volume Rename'
date: '2012-11-06T01:20:53-06:00'
status: publish
permalink: /kvm-vm-rename-and-logical-volume-rename
author: admin
excerpt: ''
type: post
id: 25
category:
- KVM
- LVM
tag: []
post_format: []
I recently provisioned a Virtual Machine in a KVM Hypervisor with a typo in the name. Even worse I also created the storage LV with a typo. Here is how I fixed it. Off course shut the VM down first.
LV Rename
# lvrename VolumeGroup oldLVname newLVname
Renamed "oldLVname" to "newLVname" in volume group "VolumeGroup"
Change reference to storage in VM XML
# virsh edit oldVMname
Domain oldVMname XML configuration edited.
# grep newLVname oldVMname.xml
<source dev="/dev/VolumeGroup/newLVname"></source>
Recreate VM
/tmp/newVMname.xml
# virsh undefine oldVMname
Domain newVMname has been undefined
# grep newVMname /tmp/newVMname.xml
newVMname
<source dev="/dev/VolumeGroup/newVMname"></source>
# virsh define /tmp/newVMname.xml
Domain newVMname defined from /tmp/newVMname.xml
# virsh list --all
Id Name State
----------------------------------
7 aVMname running
- newVMname shut off
# virsh start newVMname
Domain newVMname started