The Problem
Unable create or remove snapshot volume as error below:
# lvcreate -s -L 3G -n snapopt /dev/vgOS/opt Logical volume "snapopt" already exists in volume group "vgOS"
Whereas the logical volume is not present in any Volume Group.
# lvs LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert cplex vgOPT -wi-ao---- 3.00g oracle vgOPT -wi-ao---- 20.00g home vgOS -wi-ao---- 2.00g opt vgOS Owi-aos--- 6.45g root vgOS -wi-ao---- 6.00g swap vgOS -wi-ao---- 2.00g tmp vgOS -wi-ao---- 2.95g var vgOS Owi-aos--- 10.00g
The lvremove command would also fail with the below error.
# lvremove /dev/vgOS/snapopt Can't remove merging snapshot logical volume "snapopt"
The Solution
The snapshot was corrupted and unable to remove the snapshot using lvremove. From dmsetup table, it is evident that the snapshot is corrupted.
4 vgOS-snapopt: 0 13533184 error
1. Remove the LVM snapshot using low-level LVM tool dmsetup.
# dmsetup -f remove /dev/mapper/VG-snapopt
2. Remove the LVM snapshot using lvremove
# lvremove -f /dev/VG/snapopt