KVM not booting and getting an drive corrupt error :


Code:
an automatic file system check (fsck) of the root filesystem failed.
A manual fsck must be performed, then the system restarted
.
.
.
Give root password for maintenance
(or type Control-D to continue):
We have to run FSCK on the KVM partitions and to do so, I followed below steps.

I used 'kpartx' method with the -a flag to create the device mapper entries for the partitions:


Code:
[root@sh33 /]# kpartx -av /dev/vgroup01/kvm353_img
add map vgroup01-kvm353_img1 (253:26): 0 106950272 linear /dev/vgroup01/kvm353_img 2048
add map vgroup01-kvm353_img2 (253:27): 0 12582912 linear /dev/vgroup01/kvm353_img 106952320
Here, the partition 1 (vgroup01-kvm353_img1) is of type linux and partition 2 (vgroup01-kvm353_img2) is of type linux swap.

The final step would be to perform FSCK on this KVM partitions. This can be done using below command and this will remove unwanted orphaned inodes that are corrupting the disk.


Code:
[root@sh33 /]# e2fsck -y /dev/mapper/vgroup01-kvm353_img1
e2fsck 1.41.12 (17-May-2010)
/dev/mapper/vgroup01-kvm353_img1 contains a file system with errors, check forced.
Pass 1: Checking inodes, blocks, and sizes
Inodes that were part of a corrupted orphan linked list found.  Fix? yes

Inode 7761 was part of the orphaned inode list.  FIXED.
Inode 11205 was part of the orphaned inode list.  FIXED.
Inode 30917 was part of the orphaned inode list.  FIXED.
Inode 265520 was part of the orphaned inode list.  FIXED.
Inode 266892 was part of the orphaned inode list.  FIXED.
Inode 266981 was part of the orphaned inode list.  FIXED.
Deleted inode 1698301 has zero dtime.  Fix? yes

Now that everything is fixed. We can move ahead and delete the devmapping image created using kpartx -d command. The logical volume will remain in use until this is done so please make sure that you do not forget this step.


[
Code:
root@sh33 /]# kpartx -dv /dev/vgroup01/kvm353_img
del devmap : vgroup01-kvm353_img2
del devmap : vgroup01-kvm353_img1

Finally you can reboot the virtual machine normally.

This should bring up your virtual machine Online !!