recovery of virtual machines on KVM

Tapas Mishra mightydreams at gmail.com
Sat Feb 12 16:45:45 UTC 2011


On Thu, Feb 10, 2011 at 4:39 AM, Ahmed Kamal <ahmed.kamal at canonical.com> wrote:
> On 02/09/2011 08:39 PM, Tapas Mishra wrote:
>>
>> I  am having a virtualization setup via KVM on a Ubuntu 10.04 64 bit
>> server.
>>
>> A recent dbus update cause a crash of my Host OS.It was a post install
>> script of dbus which ultimately brought everything down.
>>
>> Now I have to basically format the host OS.My cause of concern are the
>> virtual machines which were running on it when the environment was
>> stable.Which were in separate LVM partitions.
>>
>> Some thing like
>>
>> /dev/virtualization/vm1
>> /dev/virtualization/vm2
>> /dev/virtualization/vm3
>> /dev/virtualization/vm4
>> If some one has experienced recovery of this sort in past let me know
>> what did they do to get things back. All my Virtual Machines were on
>> separate partition and in same VolumeGroup this volume group was on
>> Host OS. Will formatting of HOST os clear the Virtual Machines also in
>> my situation or just be re installing the host and importing the
>> Virtual Machines via a tool such as virt-manager I will be able to get
>> them back.
>
> It depends, if the VG is stored on the same disk and you reinstall you might
> indeed destroy the VMs. Please don't proceed until you're sure of what
> you're doing
>

Well I can not escape from restoring the production environment Ahmed.

How ever by the time of writing this message I have restored every thing.
I am sharing it here might help some one who are into similar mess.

When you insert the Ubuntu CD it will ask you for partitioning schemes
chose the guided partitioning scheme  what you have to make sure is
not to format the volume group on which all the virtual machines
reside.

While creating these guests their locations were
/etc/libvirt/qemu/*.xml

To restore the Virtual Machine go to the /etc/libvirt/ directory of
USB backup and which ever file 	you find missing on the fresh install
copy it after you have copied them

virsh define /path/to/vm.xml to define that VM in new environment (you
will see the VM might run without this but it is
advisable to do above thing)
My problem was a bit more difficult as the back I had was even buggy
so the restoration did not 	went very smooth.When  you are restoring
the VMs then I noticed  some how permissions and 	softlinks had
broken.

	Once you have finished copying the virtual machines permissions of
xml files in
	/etc/libvirt/qemu/
	should be changed to 644 any other file if you see has permission 777
needs to be 644 but the
	same does not applies to directories.

	When this was not there I noticed surprisingly the ssh connections to
the VMs after copying the 	respective XML files back were dropping.By
the time I wrote down this it was confirmed the 	backup I had
permissions problem.

	Files  in /etc/libvirt/qemu/*.xml on backup had permissions 777

	where in the correct permissions should be 700 for these XMLs.
I want to mention 2 links if some comes across this thread should help them
	https://www.redhat.com/archives/virt-tools-list/2011-February/msg00074.html

by changing the above xml files permission I observed our SSH
connection drop problem also got resolved.
	How ever due to a DNS resolution failure the DomU social was failing
to restart many teams after 	each reboot of Dom0.So I had to manually
login and start it.
By  now I have successfully restored all the environment.


	https://www.redhat.com/archives/virt-tools-list/2011-February/msg00060.html




More information about the ubuntu-server mailing list