lvremove claims LV to be open

So there is yet another possibility other than NFS, stale bash process and udev misbehaviour, namely partitions opened on the block device.

kpartx -d /dev/vg1/lv1

Then you can verify that # open drops to 0 in lvdisplay's output.


It seems that there is a problem with the cooperation between lvm and udev.

On a lvremove, there are udev change events for every available block device. Their processing seems to disturb the removal process, and removal fails.

The solution is to deactivate the LV(s) to be removed with lvchange -an <given LV>. In this case, only a handful of "remove" events is created, which results from the associated dm device being removed.

If I lvremove the now deactivated LV, there are still a lot of udev change events, but they do not affect the LV to be removed (because it doesn't exist in the dm any longer), so it works without problems.


Remove all mappings to that LV from /dev/mapper/ by deleting the symlinks and then you will be able to remove it.

Tags:

Hard Drive

Lvm