How can I shut down/"unmount" a Linux lvm2 physical volume?
I plugged an external had drive to my computer. On the drive is a LVM2 PV with one volume group which has some logical volumes. I now want to remove this drive again properly.
I unmounted the filesystems, deactivated all logical volumes and the volume group.
How can I deactivate the physical volume? Or make the PV and the VG unknown to Linux again? Like just the opposite of lvmdiskscan and vgchange -a y ?
I want to leave the PV/VG and LVs on the disk intact.
lvchange -an <lvpath>
vgchange -an <vgname>
If you also want to remove the device maps you can use
dmsetup ls
dmsetup remove <name>