How to reduce/remove the lvm thin pool ?

Latest response

Is it possible to reduce/remove a lvm thin pool and if possible then what are the best practices for it?

RHEL 7

Responses

Hello Subarno - I am sure you have workaround by now as I can see this post created back on March 2022. If not, you can refer the below steps. Here, all I did is to find the process that is keeping the logical volume open and kill PID or stopping service in this case to get the volume removed.

[Prod root @ SAHA-RHEL7 /]

pvs

PV VG Fmt Attr PSize PFree
/dev/sdf VolBDSCStore lvm2 a-- 16.37t 0 [Prod root @ SAHA-RHEL7 /]

vgs

VG #PV #LV #SN Attr VSize VFree
VolBDSCStore 1 1 0 wz--n- 16.37t 0 [Prod root @ SAHA-RHEL7 /]

lvs

LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert thinpool VolBDSCStore -wi-ao---- 16.37t
[Prod root @ SAHA-RHEL7 /]

vgremove VolBDSCStore

Do you really want to remove volume group "VolBDSCStore" containing 1 logical volumes? [y/n]: y Logical volume VolBDSCStore/thinpool contains a filesystem in use. [Prod root @ SAHA-RHEL7 /]

lvchange -an /dev/mapper/VolBDSCStore-thinpool

Logical volume VolBDSCStore/thinpool contains a filesystem in use. [Prod root @ SAHA-RHEL7 /]

dmsetup info -c | grep VolBDSCStore-thinpool

VolBDSCStore-thinpool 253 5 L--w 1 1 0 LVM-C5Wmff5reaoEv1QTIy6LsDqFJwtFOoUZoLfR8jtQHzoyWm3zzWcCpzabETpkpiXn

lsof | grep "253,5"

dockerd 13655 31954 root 11uW REG 253,5 32768 55834575361 /volumes/metadata.db dockerd 13655 37721 root mem-W REG 253,5 23622320705 /builder/fscache.db (stat: No such file or directory) [Prod root @ SAHA-RHEL7 /]

systemctl stop docker

[Prod root @ SAHA-RHEL7 /]

lsof | grep "253,5"

[Prod root @ SAHA-RHEL7 /]

vgremove VolBDSCStore

Do you really want to remove volume group "VolBDSCStore" containing 1 logical volumes? [y/n]: y Do you really want to remove active logical volume VolBDSCStore/thinpool? [y/n]: y Logical volume "thinpool" successfully removed Volume group "VolBDSCStore" successfully removed