2

I need to be able to deactivate an LV but cannot after partprobing it and finding gaining access to its partitions in /dev/mapper. It seems I need some way of 'un-partprobing' the disk, but I have no idea how and would welcome some advice.

Here's what's happening, in case I'm missing something else:

lvchange -a y /dev/vg/mylv activates the lv fine

partprobe /dev/vg/mylv results in lv partition being found and device creation at /dev/mapper/vg-mylvp1

lvchange -a n /dev/vg/mylv now fails - LV vg/mylv in use: not deactivating

Just to be clear I've checked that this volume is not mounted using every method I know how (including those suggested here). I presume it is in use/being held somewhere, but I cannot determine where. It is only after running partprobe that I can no longer deactivate the LV. Is there any way to force the deactivation? Has anyone else come across this?

26/7 - Still not managed to progress on from this issue. I did, however, come across this forum post talking about an LV staying 'open' if mounted as a loop. Could this be what is happening here? Does partprobe read using a loop mount? How can I see a list of active loop devices?

2
  • Can not reproduce that problem. Doing a "lvchang -a n" works just fine even if partprobe has been run, there is a /dev/mapper/ entry etc. Are you sure there is no automatic mounting happening? Because the error message you get I exactly what I get after I've also mounted the logical volume.
    – andol
    Jul 20, 2010 at 18:22
  • Definitely does not seem to be mounted.
    – Joe
    Jul 20, 2010 at 19:42

2 Answers 2

3

The helpful folks at the #lvm channel on Freenode found a solution for me! One simply needs to deactivate the partition mapping using the command kpartx -d /dev/vg/mylv

This removes the partition device entry and allows me to once against deactivate the LV without problems.

-1

Something has that lv mounted. Unmount it first, then deactivate it.

5
  • Well, I'm using LVMs as storage for Xen domains so partitioning them seems perfectly natural. I'll check once more for any mount points though.
    – Joe
    Jul 20, 2010 at 19:30
  • Sorry about that. I do the same thing (under KVM). But why have the host mess with the partitions on the LV? I usually do everything I need from the VMs. Try using fuser to if it will tell you what has it mounted.
    – Allen
    Jul 20, 2010 at 21:08
  • I'm trying to provision the initial template (os file system etc) in a partition before running each vm for the first time. And fuser reports nothing, checked both the partition device and the lv device in three locations - /dev/mapper/vg-mylv, /dev/dm-3 (as fdisk shows it to exist as) and /dev/vg/mylv.
    – Joe
    Jul 20, 2010 at 21:38
  • Try using another VM for the provisioning. Has the benefit of testing the LV as a disk for a VM.
    – Allen
    Jul 24, 2010 at 13:45
  • A device lock doesn't necessarily imply a mount.
    – Stephan
    Mar 21, 2014 at 0:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .