Partitions of LVM logical volume

Quick how-to for registering and unregistering partitions on LVM logical volume (yes, event that is possible ;).

Register partitions

This is needed to make the accessible – a.k.a to create a dev for them. You can use partprobe (part of the parted package) or kpartx.

$ partprobe /dev/vg0/lv1

$ kpartx -a /dev/vg0/lv1


Unregister partitions

For unregistering partitions from kernel, i.e. because you want to remove the logical volume and lvremove says ‘‘Logical volume vg0/lv1 is used by another device.‘ you can do following:

$ lvremove vg0/lv1
Logical volume vg0/lv1 is used by another device.

$ dmsetup ls
vg0-lv1   (253:18)
vg0-lv1p1 (253:19)
vg0-vv1p2 (253:20)

$ dmsetup remove vg0-lv1p1
$ dmsetup remove vg0-lv1p2

$ lvremove vg0/lv1
Do you really want to remove and DISCARD active logical volume....

Command outputs and device paths might differ – this is just an example, but now you should have an idea how to do it…