Monday, September 6, 2010

Add a Recovery Disk to KVM and Recover the VM

There might be situations when you see a corrupted File system in KVM VM. In such situation you can add a ISO rescue cd and fix the file system errors.

For example I have a VM named "centos". Take the VM configuration file /etc/libvirt/qemu/centos.xml

Add the following lines in the configuration file above the disk image of the VM.

Then execute the command virsh and enter the following command.

virsh # define /etc/libvirt/qemu/centos.xml
Domain centos defined from /etc/libvirt/qemu/centos.xml

virsh # start centos
Domain centos started

During booting process press f12 so that you get the booting option and select CDROM. Now that the VM boots with the ISO image and you can do the filesystem recovery process.

fsck -y /dev/mapper/VolGroup00-LogVol00

Reboot the VM and ensure that you are able to access the VM without any file system errors.

No comments:

Post a Comment