Unable to remove LVs
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
Quoted 6 lines · Jan Bakuwel
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.
Quoted 1 line
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).
Quoted 1 line
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
Quoted 2 lines
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.
Hi Bryn,
Quoted 4 lines
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
Quoted 7 lines
Quoted 3 lines
server1:/# lvs | grep oa pdc.oa.c d -wi-ao 37.00GThe LV is still showing as active and open here. You should be able to remove it with lvremove
d/pdc.oa.cor 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
Quoted 4 lines
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
Quoted 8 lines · Jan Bakuwel
Hi Bryn,
Quoted 4 lines
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.
Quoted 6 lines · Bryn M. Reeves
Quoted 5 lines · Jan Bakuwel
Hi Bryn,
Quoted 3 lines
The partition map has a 'p' separator - d-pdc.oa.cp1 - the correct command is:
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
kpartx -d
/dev/mapper/d-pdc.oa.c# kpartx -d /dev/mapper/d-pdc.oa.cIt'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.
A message that is not in the archive (sent off-list or not yet received): [email protected]
Kia ora Bryn,
Quoted 4 lines · Jan Bakuwel
Hi Bryn,
After:
Quoted 9 lines
# kpartx -d -pp /dev/mapper/d-pdc.oa.cI 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
Signature · 5 lines
Omiha Systems Ltd NEW ZEALAND p +64 9 950 3007 m +64 21 027 51803 m +64 22 103 9151
[linux-lvm] Unable to remove LVs - problem solved.
In reply to a message not in the archiveHi 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