[linux-lvm] Unable to remove LVs

Bryn M. Reeves bmr at redhat.com
Mon Nov 14 15:10:12 UTC 2011


On 11/14/2011 04:30 AM, Jan Bakuwel wrote:
> server1:/# ls -al /dev/mapper/*oa*
> brw-rw---- 1 root disk 254,  7 2011-07-22 19:40 /dev/mapper/d-pdc.oa.c
> brw-rw---- 1 root disk 254, 78 2011-10-30 13:04 /dev/mapper/d-pdc.oa.cp1
> server1:/# kpartx -l /dev/mapper/d-pdc.oa.c
> d-pdc.oa.c1 : 0 71103627 /dev/mapper/d-pdc.oa.c 63
> server1:/# kpartx -d /dev/mapper/d-pdc.oa.c

This should have removed the <name>p1 partition map previously created 
by kpartx -a.

> server1:/# kpartx -d /dev/mapper/d-pdc.oa.c1

The kpartx command expects the base device as its argument (as you gave 
in the previous command). This should be "/dev/mapper/d-pdc.oa.c" (the 
'1' is the partition index and the 'p' is the separator).

> failed to stat() /dev/mapper/d-pdc.oa.c1

The partition map has a 'p' separator - d-pdc.oa.cp1 - the correct 
command is:

kpartx -d /dev/mapper/d-pdc.oa.c

> server1:/# lvs | grep oa
>    pdc.oa.c         d    -wi-ao  37.00G

The LV is still showing as active and open here. You should be able to 
remove it with lvremove d/pdc.oa.c or shut it down with 
vgchange/lvchange after correctly removing the kpartx mapping.

If it still shows as open you may want to look at the output of "dmsetup 
ls --tree" to see if there are other device-mapper devices using it and 
make sure that it's not mounted anywhere.

Regards,
Bryn.




More information about the linux-lvm mailing list