[CentOS-virt] Cannot remove lvs associated with deleted vm guests

Mon Jan 30 15:10:38 UTC 2012
James B. Byrne <byrnejb at harte-lyne.ca>

On Sat, January 28, 2012 12:19, Phil Schaffner wrote:
> Pardon the top-post and cross-post, but this apparently
> should have gone
> to centos-virt at centos.org
>
> Phil
>
> chris procter wrote on 01/27/2012 03:29 PM:
>> Hi,
>>
>> Its ages since I came across this problem so my memory
>> is a little hazey but something is obviously holding on
>> to the lv so you'll need to figure out whats holding it
>> and kill that. The open value returned by "dmsetup info"
>>  is how many things have the device file open), it looks
>> to be 2 at the moment and you cant "dmsetup remove"
>> untill its zero (lvm might  be one of them I cant
>> remember)
>>
>>
>> A few things worth trying are
>>
>>
>> 1) make sure its not mounted anywhere!

[root at vhost01 ~]# umount /dev/vg_vhost01/lv_vm_base
umount: /dev/vg_vhost01/lv_vm_base: not mounted

>> 2) if multipathd is running try stopping that.

[root at vhost01 ~]# ps -ef | grep multipathd
root       465   307  0 09:40 pts/0    00:00:00 grep
multipathd
[root at vhost01 ~]# service multipathd status
multipathd: unrecognized service
[root at vhost01 ~]# find / -name multipathd
[root at vhost01 ~]#

>> 3) either lsof or fuser on the device file may be able

[root at vhost01 ~]# fuser /dev/vg_vhost01/lv_vm_base
[root at vhost01 ~]# lsof /dev/vg_vhost01/lv_vm_base
[root at vhost01 ~]#

>> 4) something vm related might not have let go properly,
>> are there any deamons/processes etc still running?

There are many vm qeum processes running, non contain any
reference to lv_vm_base

[root at vhost01 ~]# ps -ef | grep vm_base
root       549   307  0 09:44 pts/0    00:00:00 grep vm_base
[root at vhost01 ~]#

>> 5) reboot, the sledgehammer aproach to killing off
>> processes!!
>>
>> 6) you could try hitting it with dmsetup again, you need
>> to suspend the device first using "dmsetup suspend"
>> which *may* persuade the holding process to let go, if
>> it does reduce the open count you'll need to "dmsetup
>> resume" and then suspend again untill open reaches zero
>> when "dmsetup remove" should work. I'd try and avoid
>> this option if you can, you're messing beneath the lvm
>> layer and it may not like that, should be ok but...

[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
[root at vhost01 ~]# dmsetup suspend vg_vhost01-lv_vm_base
[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

>> if none of that is possible/works you could try asking
>> on the lvm-linux list.

Am so doing.

>>
>>
>> Reinstalling really shouldn't be necesary.
>>

Yes.  However.  .  .


-- 
***          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