Bug#549691: lvm2: More info: how to reproduce and fix

George Tellalov gtellalov at bigfoot.com
Tue Jun 3 12:56:06 UTC 2014


Package: lvm2
Followup-For: Bug #549691

I had a problem with LVM refusing to remove a volume that wasn't in use and my
search led me to this bug report. Here I found out about dmsetup and playing
around with it I managed to remove the problematic volume. Here's how I did
it (on a pure wheezy install). 

First a way to reproduce the problem:

# lvcreate -n test -L 100M hdd
  Logical volume "test" created

# parted -s /dev/hdd/test mklabel msdos mkpart pri 32256b 100M
Warning: The resulting partition is not properly aligned for best performance.

# lvchange -a n hdd/test
  Logical volume hdd/test is used by another device.

This is it - nothing is mounted or accessed by any programs. Actually the
partition doesn't even have a file system to be mounted.

The problem seems to be that device mapper creates a device file for the new
partition and because of it the volume "test" is considered in use.

# dmsetup ls | grep test
hdd-test        (254:4)
hdd-testp1      (254:5)

And the solution is to remove the partition device and then the volume can be
deactivated and removed as well.

# dmsetup remove hdd-testp1
# lvchange -a n hdd/test
# lvremove hdd/test
  Logical volume "test" successfully removed

I'm not sure if this is related to the original bug report, but some of the
users' reports are probably related. I hope this helps.


-- System Information:
Debian Release: 7.5
Architecture: armhf (armv6l)

Kernel: Linux 3.6.11+ (PREEMPT)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash



More information about the pkg-lvm-maintainers mailing list