frequently I notice that after a
$ sudo lvcreate vg -L 10G
immediately followed by a
$ sudo lvremove vg/<created volume>
I get the error message
Can't remove open logical volume "…"
while a
$ sudo lvs
shows me for that volume
lvol2 vg -wi-a- 10,00g
- so there os a
-
after thea
in the flags, where there should be ano
if the volume was really open.
After some time, deletion works.
Why is that the case? How can I make it work immediately?
EDIT: The following did not lead to something useful:
$ sudo rm /dev/mapper/vg-lvol24
$ sudo lvremove /dev/vg/lvol24
Can't remove open logical volume "lvol24"
$ sudo lvs vg/lvol24
LV VG Attr LSize Origin Snap% Move Log Copy% Convert
lvol24 vg -wi-a- 10,00g
$ sudo lvremove /dev/vg/lvol24
Can't remove open logical volume "lvol24"
Best Answer
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.