What to do when you have a corrupted LVM filesystem (centos)?

– Boot the server with a Centos cd.
– Press [F5-Rescue]:; > [linux rescue] – Don’t startup the network interfaces
– Skip mounting the filesystem (don’t even mount it read-only !)

lvm vgchange --ignorelockingfailure -P -a y
fdisk -l

The output will be something like this:

Disk /dev/sda: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14         261     1992060   8e  Linux LVM

You see now your partitions. The smallest is normally your boot partition /boot, the large one was /.

– mkdir /mnt/boot
– mount /dev/sda1 /mnt/boot

[you have to mount the device that you just have found with fdisk -l]

– Look up the device node for the / filesystem

cat /mnt/boot/grub/grub.conf

It should be something like /dev/VolGroup00/LogVol00 (if you have used the default installation of CentOS).

Check the filesystem:

fsck -f -y /dev/VolGroup00/LogVol00

Wait … wait … wait … Be Patient !!

Reboot and keep your fingers crossed 🙂