[linux-lvm] lvm_lv_deactivate seems to have no effect, LV is still available in lvdisplay

Alexander Lyakas alex.bolshoy at gmail.com
Sun Jul 24 07:47:01 UTC 2011

OK, since nobody answered, let me perhaps ask a different question.

Is there any way to prevent any automatic LV activation/deactivation?
And have full manual control via lvm_lv_deactivate/lvm_lv_activate?

Setting activation = 0 in global section of lvm.conf did not do the
job, because then lvm_vg_create_lv_linear fails, so I even cannot
create a LV.


On Tue, Jul 19, 2011 at 5:14 PM, Alexander Lyakas
<alex.bolshoy at gmail.com> wrote:
> Hello everybody,
> I am using stock ubuntu natty with lvmlib 2.02.66:
> root at 11:/mnt/work/alex# uname -a
> Linux 11 2.6.38-8-server #42-Ubuntu SMP Mon Apr 11 03:49:04 UTC 2011
> x86_64 x86_64 x86_64 GNU/Linux
> In my code I open a VG, iterate over all the LVs and then call
> lvm_lv_deactivate() on each LV. The return value is 0, and also
> immediately after that, I call lvm_lv_is_active() for each LV and
> assert that it returns 0 (not-active).
> Later in the code, I close the VG handle.
> However, when I issue lvdisplay from command-line, I still see:
> LV Status              available
> and the dm device files for the LVs are also present (/dev/dm-0 etc).
> As a result I cannot later stop the underlying md devices (PVs) using
> 'mdadm --stop'.
> If I do lvchange -an from the command line later, it succeeds, LV
> status becomes 'NOT available' and I am able to stop the md arrays.
> From looking at the code of lvmlib, it looks like lvm_lv_deactivate()
> does not require lvm_vg_write(); I see that lvchange implementation
> does not seem to call this when de-activating LVs. Still, I have tried
> to call lvm_vg_write() with same effect.
> No other application on the machine uses the same VG (at least not
> that I know of).
> Can anybody please advise what I might be missing.
> Thanks,
>  Alex.

More information about the linux-lvm mailing list