[linux-lvm] Cannot delete lv

James B. Byrne byrnejb at harte-lyne.ca
Mon Jan 30 15:44:19 UTC 2012


CentOS-6.2

lvm2-2.02.87-6.el6

qemu-kvm-0.12.1.2-2.209.el6_2.1

I have encountered a problem deleting logical volumes
associated with kvm guests that have been removed.  These
guest virtual machines were deleted because somehow each
had become able to see some of the VirtIO disks assigned
as physical volumes to the others.

It was suggested to me that this may have been caused by
attempting to add a new VirtIO disk created through
virt-manager as a physical device before it was initially
partitioned.  Surprisingly, if this is indeed the case,
virt-manager does not initially partition VirtIO disks, as
it does IDE virtual disks.

However, whatever the proximate or root causes are, when
the damaged guests were removed via virt-manager, together
with their storage, the guest vms were removed but the
lvremove command failed to remove the assigned storage:

 /sbin/lvremove -f /dev/vg_vhost01/lv_vm_base
    Can't remove open logical volume "lv_vm_base"

This pattern of failure repeated because the device showed
that was opened by two processes.

[root at vhost01 ~]#  dmsetup info -c vg_vhost01-lv_vm_base
Name                  Maj Min Stat Open Targ Event  UUID
vg_vhost01-lv_vm_base 253   5 L--w    2    1      0
LVM-gXMt00E1RDjpSX3INLZ35Prtg66aX36BeAOlKIkmfSNQRNol3Hni920R4YVaZr52

However, these processes seem to be invisible to me:

[root at vhost01 ~]#
[root at vhost01 ~]# fuser /dev/vg_vhost01/lv_vm_base
[root at vhost01 ~]#
[root at vhost01 ~]# lsof /dev/vg_vhost01/lv_vm_base
[root at vhost01 ~]#
[root at vhost01 ~]# umount /dev/vg_vhost01/lv_vm_base
umount: /dev/vg_vhost01/lv_vm_base: not mounted
[root at vhost01 ~]#
[root at vhost01 ~]# /sbin/lvremove -f
/dev/vg_vhost01/lv_vm_base
  Can't remove open logical volume "lv_vm_base"
[root at vhost01 ~]#

It was suggested on the centos-virt mailing list that I
try using dmsetup to suspend this device:

[root at vhost01 ~]# dmsetup suspend vg_vhost01-lv_vm_base
[root at vhost01 ~]#
[root at vhost01 ~]# dmsetup info -c vg_vhost01-lv_vm_base
Name                  Maj Min Stat Open Targ Event  UUID
vg_vhost01-lv_vm_base 253   5 L-sw    2    1      0
LVM-gXMt00E1RDjpSX3INLZ35Prtg66aX36BeAOlKIkmfSNQRNol3Hni920R4YVaZr52
[root at vhost01 ~]#

Which apparently had no effect:

[root at vhost01 ~]#  dmsetup info -c vg_vhost01-lv_vm_base
Name                  Maj Min Stat Open Targ Event  UUID
vg_vhost01-lv_vm_base 253   5 L-sw    2    1      0
LVM-gXMt00E1RDjpSX3INLZ35Prtg66aX36BeAOlKIkmfSNQRNol3Hni920R4YVaZr52

However, now when I run lvremove, the command simply
becomes unresponsive and does not return, even when a ^C
interrupt is attempted.

[root at vhost01 ~]#  /sbin/lvremove -f
/dev/vg_vhost01/lv_vm_base

^C
^C


On another terminal, after some 15 minutes of waiting, I
see this:

[root at vhost01 ~]# ps -ef | grep remove
root      1460   307  0 10:07 pts/0    00:00:00
/sbin/lvremove -f /dev/vg_vhost01/lv_vm_base


How do I delete these logical volumes, for there are three
of them?

-- 
***          E-Mail is NOT a SECURE channel          ***
James B. Byrne                mailto:ByrneJB at Harte-Lyne.ca
Harte & Lyne Limited          http://www.harte-lyne.ca
9 Brockley Drive              vox: +1 905 561 1241
Hamilton, Ontario             fax: +1 905 561 0757
Canada  L8E 3C3




More information about the linux-lvm mailing list