linux-lvm.redhat.com archive mirror
 help / color / mirror / Atom feed
* [linux-lvm] Unable to remove LVs
@ 2011-11-14  4:30 Jan Bakuwel
  2011-11-14 15:10 ` Bryn M. Reeves
  0 siblings, 1 reply; 7+ messages in thread
From: Jan Bakuwel @ 2011-11-14  4:30 UTC (permalink / raw)
  To: linux-lvm

Hi,

LVM 2.02.39-7 on Debian Lenny 64 bit with Xen 3.2-1

I have a few LVs that I can't get rid of:

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
server1:/# kpartx -d /dev/mapper/d-pdc.oa.c1
failed to stat() /dev/mapper/d-pdc.oa.c1
server1:/# lvs | grep oa
  pdc.oa.c         d    -wi-ao  37.00G                                    

There were a couple of other open LVs that I could successfully delete
using the method described above but this one seems to be a bit harder
to convince. The LV surely isn't open by anything I can identify (not
mounted etc), but the kernel seems to think otherwise.

Any suggestions?

kind regards,
Jan

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [linux-lvm] Unable to remove LVs
  2011-11-14  4:30 [linux-lvm] Unable to remove LVs Jan Bakuwel
@ 2011-11-14 15:10 ` Bryn M. Reeves
  2011-11-15  6:44   ` Jan Bakuwel
  0 siblings, 1 reply; 7+ messages in thread
From: Bryn M. Reeves @ 2011-11-14 15:10 UTC (permalink / raw)
  To: LVM general discussion and development; +Cc: Jan Bakuwel

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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [linux-lvm] Unable to remove LVs
  2011-11-14 15:10 ` Bryn M. Reeves
@ 2011-11-15  6:44   ` Jan Bakuwel
  2011-11-15 11:07     ` Bryn M. Reeves
  0 siblings, 1 reply; 7+ messages in thread
From: Jan Bakuwel @ 2011-11-15  6:44 UTC (permalink / raw)
  To: linux-lvm

Hi Bryn,
 
> The partition map has a 'p' separator - d-pdc.oa.cp1 - the correct
> command is:
>
> kpartx -d /dev/mapper/d-pdc.oa.c

# kpartx -d /dev/mapper/d-pdc.oa.c
# kpartx -l /dev/mapper/d-pdc.oa.c
d-pdc.oa.c1 : 0 71103627 /dev/mapper/d-pdc.oa.c 63
# lvs | grep oa
  pdc.oa.c         d    -wi-ao  37.00G      

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

# lvremove d/pdc.oa.c
  Can't remove open logical volume "pdc.oa.c"
# lvchange -a n d/pdc.oa.c
  LV d/pdc.oa.c in use: not deactivating

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

# dmsetup ls --tree
d-pdc.oa.cp1 (254:78)
 └─d-pdc.oa.c (254:7)
    └─ (8:11)


I'm positive it's not mounted anywhere.

Any advice how to proceed from here?

kind regards,
Jan

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [linux-lvm] Unable to remove LVs
  2011-11-15  6:44   ` Jan Bakuwel
@ 2011-11-15 11:07     ` Bryn M. Reeves
  2011-11-15 11:16       ` Bryn M. Reeves
  0 siblings, 1 reply; 7+ messages in thread
From: Bryn M. Reeves @ 2011-11-15 11:07 UTC (permalink / raw)
  To: LVM general discussion and development; +Cc: Jan Bakuwel

On 11/15/2011 06:44 AM, Jan Bakuwel wrote:
> Hi Bryn,
>
>> The partition map has a 'p' separator - d-pdc.oa.cp1 - the correct
>> command is:
>>
>> kpartx -d /dev/mapper/d-pdc.oa.c
>
> # kpartx -d /dev/mapper/d-pdc.oa.c

It's possible kpartx is getting confused and is refusing to remove the 
maps if they still exist after running this command.

You can try to remove the device manually with dmsetup:

dmsetup remove d-pdc.oa.cp1

If this succeeds then you can proceed to deactivate the lv/vg. If it 
fails then there is something still using the device and you'll need to 
figure out what it is to get rid of the devices.

Regards,
Bryn.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [linux-lvm] Unable to remove LVs
  2011-11-15 11:07     ` Bryn M. Reeves
@ 2011-11-15 11:16       ` Bryn M. Reeves
       [not found]         ` <4EC2D031.3090101@omiha.com>
  0 siblings, 1 reply; 7+ messages in thread
From: Bryn M. Reeves @ 2011-11-15 11:16 UTC (permalink / raw)
  To: LVM general discussion and development; +Cc: Jan Bakuwel

On 11/15/2011 11:07 AM, Bryn M. Reeves wrote:
> On 11/15/2011 06:44 AM, Jan Bakuwel wrote:
>> Hi Bryn,
>>
>>> The partition map has a 'p' separator - d-pdc.oa.cp1 - the correct
>>> command is:
>>>
>>> kpartx -d /dev/mapper/d-pdc.oa.c
>>
>> # kpartx -d /dev/mapper/d-pdc.oa.c
>
> It's possible kpartx is getting confused and is refusing to remove the
> maps if they still exist after running this command.

That seems to be the case:

# vgcreate d /dev/loop0
   Volume group "d" successfully created
# lvcreate -n pdc.oa.c -L 4m d
   Logical volume "pdc.oa.c" created
# fdisk /dev/d/pdc.oa.c
[...]
# kpartx -l /dev/mapper/d-pdc.oa.c
d-pdc.oa.c1 : 0 8191 /dev/mapper/d-pdc.oa.c 1
# ls /dev/mapper/d-pdc.oa.c*
/dev/mapper/d-pdc.oa.c  /dev/mapper/d-pdc.oa.cp1
# kpartx -d /dev/mapper/d-pdc.oa.c
# kpartx -l /dev/mapper/d-pdc.oa.c
d-pdc.oa.c1 : 0 8191 /dev/mapper/d-pdc.oa.c 1
# ls /dev/mapper/d-pdc.oa.c*
/dev/mapper/d-pdc.oa.c  /dev/mapper/d-pdc.oa.cp1

It does the right thing if you specify the partition separator on the 
command line:

# kpartx -d -pp /dev/mapper/d-pdc.oa.c
# ls /dev/mapper/d-pdc.oa.c
/dev/mapper/d-pdc.oa.c

Regards,
Bryn.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [linux-lvm] Unable to remove LVs
       [not found]         ` <4EC2D031.3090101@omiha.com>
@ 2012-09-17 23:54           ` Jan Bakuwel
  2012-09-18  1:10           ` [linux-lvm] Unable to remove LVs - problem solved Jan Bakuwel
  1 sibling, 0 replies; 7+ messages in thread
From: Jan Bakuwel @ 2012-09-17 23:54 UTC (permalink / raw)
  To: Bryn M. Reeves; +Cc: linux-lvm

Kia ora Bryn,


On 16/11/11 09:48, Jan Bakuwel wrote:
> Hi Bryn,
>
> After:
>
> # kpartx -d -pp /dev/mapper/d-pdc.oa.c
>
> I was able to remove the LV.
>
> Thanks very much for your advice - much appreciated.
>
> kind regards,
> Jan
>


It seems I'm being bitten again by this. Last time you kindly helped me
resolve this issue on a Debian Lenny (kernel 2.6.26-2-xen-amd64, lvm
2.02.39-7, kpartx 0.4.8-14+lenny2).

This time it's a slightly older system (Debian Etch, kernel
2.6.18-6-xen-amd64, lvm 2.02.06-4eth1) but in a rather remote location
(at sea). The system is rock solid otherwise and upgrading is quite an
undertaking so if at all possible I hope to be able to resolve this
issue without upgrading.

Any advice you can offer is much appreciated.

kind regards,
Jan



# lvs
  LV         VG   Attr   LSize   Origin Snap%  Move Log Copy%
  xm.dt1     d    -wi-a-   8.10G                             
  xm.dt1old  d    -wi-a-   8.10G                             
  xm.dt2     d    -wi-ao  12.00G                             
  xm.fms     d    -wi-ao  12.10G                             
  xm.w2k     d    -wi-ao  12.10G                             
  xm.wxp     d    -wi-ao   8.10G                             
  xm.wxp-eng d    -wi-ao   8.10G                             
  xm.wxp-ro  d    -wi-ao   8.10G                             

# kpartx -l /dev/mapper/d-xm.dt1old
d-xm.dt1old1 : 0 16980642 /dev/mapper/d-xm.dt1old 63
# kpartx -d -pp /dev/mapper/d-xm.dt1old
# kpartx -l /dev/mapper/d-xm.dt1old
d-xm.dt1old1 : 0 16980642 /dev/mapper/d-xm.dt1old 63

# ls -al /dev/mapper
total 0
drwxr-xr-x  2 root root     620 2012-09-17 23:17 .
drwxr-xr-x 19 root root    5140 2012-09-17 23:17 ..
crw-rw----  1 root root  10, 62 2044-01-30 07:04 control
brw-rw----  1 root disk 254, 21 2044-01-30 07:05 d-xm.dt1
brw-rw----  1 root disk 254, 12 2044-01-30 07:05 d-xm.dt1old
brw-rw----  1 root disk 254, 22 2044-01-30 07:05 d-xm.dt2
brw-rw----  1 root disk 254, 15 2012-09-17 23:25 d-xm.fms
brw-rw----  1 root disk 254, 24 2044-01-30 07:05 d-xm.fms1
brw-rw----  1 root disk 254, 18 2044-01-30 07:05 d-xm.w2k
brw-rw----  1 root disk 254, 25 2044-01-30 07:05 d-xm.w2k1
brw-rw----  1 root disk 254, 23 2012-09-17 03:40 d-xm.wxp
brw-rw----  1 root disk 254, 29 2044-01-30 07:05 d-xm.wxp1
brw-rw----  1 root disk 254, 19 2044-01-30 07:05 d-xm.wxp--eng
brw-rw----  1 root disk 254, 27 2044-01-30 07:05 d-xm.wxp--eng1
brw-rw----  1 root disk 254, 13 2044-01-30 07:05 d-xm.wxp--ro
brw-rw----  1 root disk 254, 20 2044-01-30 07:05 d-xm.wxp--ro1


-- 

Omiha Systems Ltd
NEW ZEALAND
p +64 9 950 3007
m +64 21 027 51803
m +64 22 103 9151

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [linux-lvm] Unable to remove LVs - problem solved.
       [not found]         ` <4EC2D031.3090101@omiha.com>
  2012-09-17 23:54           ` Jan Bakuwel
@ 2012-09-18  1:10           ` Jan Bakuwel
  1 sibling, 0 replies; 7+ messages in thread
From: Jan Bakuwel @ 2012-09-18  1:10 UTC (permalink / raw)
  To: Bryn M. Reeves; +Cc: linux-lvm

Hi Bryn,

I managed to figure it out.

dmsetup remove /dev/mapper/d-xm.dt1old1

removes the partition.

Then I can remove the LV.

Sorry to bother you.

Jan

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-09-18  1:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-14  4:30 [linux-lvm] Unable to remove LVs Jan Bakuwel
2011-11-14 15:10 ` Bryn M. Reeves
2011-11-15  6:44   ` Jan Bakuwel
2011-11-15 11:07     ` Bryn M. Reeves
2011-11-15 11:16       ` Bryn M. Reeves
     [not found]         ` <4EC2D031.3090101@omiha.com>
2012-09-17 23:54           ` Jan Bakuwel
2012-09-18  1:10           ` [linux-lvm] Unable to remove LVs - problem solved Jan Bakuwel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).