How to: Repair a lvm thin pool

Sometimes there can be error like the following:

Thin's thin-pool needs inspection.

It can appear for many reason, usually the reason of metadata or the data has overflown for the main pool. Here are the steps to repair the thin pool:

First, deactivate all the volumes under thin pool. For example, if you have a logical volume vpsextra under thin pool tp0 and volume group vg0, you would require to run the following:

lvchange -an /dev/vg0/vpsextra

Once your all the logical volumes are deactivated, you may run the lvconvert repair on the thin pool itself, not the logical volume:

lvconvert --repair vg0/tp0

Once the repair is done, you may reactivate the logical volumes:
lvchange -ay /dev/vg0/vpsextra

You may also need to extend the pool, if you do not have the auto extension working on your thin pool:
lvextend -L+15G /dev/vg0/tp0

Once all done, if you see a superblock error or a file system error while mounting the logical volume, run e2fsck:

e2fsck -yf /dev/mapper/vg0-vpsextra

If everything goes alright, you should be able to bring the lv back online. 

Note: If the thin pool is overflown, do not run lvextend without unmounting the partition. This can sometimes cause file system error.
  • lvm, thin pool, repair thin pool, thin volume, repair lvm, lvmconvert
  • 6 Users Found This Useful
Was this answer helpful?

Related Articles

LVM Cheatsheet

To install LVM2 in CentOS/Redhat servers: yum install lvm2 1. Add a partition to physical...

How to: Extend LVM partition

To increase the partition lv0 under volume group vg0 by 50GB, use lvextend command: lvextend...

How to: LVM Snapshot

LVM snapshot can be useful for filesystem integrity check and backups. A snapshot of size 15GB...

How to: Device Mapper Number to LV Name

It is often confusing when device mapper number appears while troubleshooting in place of logical...

How to: List volume id or uuid in Linux

There are places where it is called volume id like r1soft, while most of the cases they are...