When I try to remove a logical volume I get the message

#lvremove /dev/my-volumes/volume-1 
Can't remove open logical volume "volume-1"

#lvchange -an -v /dev/my-volumes/volume-1 
Using logical volume(s) on command line
/dev/dm-1: read failed after 0 of 4096 at 0: Input/output error
Deactivating logical volume "volume-1"
Found volume group "my-volumes"
LV my-volumes/volume-1 in use: not deactivating

#lvremove -vf /dev/my-volumes/volume-1 
Using logical volume(s) on command line
/dev/dm-1: read failed after 0 of 4096 at 0: Input/output error
Can't remove open logical volume "volume-1"

#lvs
/dev/dm-1: read failed after 0 of 4096 at 0: Input/output error
LV              VG           Attr   LSize   Origin Snap%  Move Log Copy%  Convert
volume-1        my-volumes   -wi-ao  50.00g  

How can I force the removal of this volume?

Thanks, Everett

link|improve this question

60% accept rate
feedback

2 Answers

What does the logical volume contain? Is it a filesystem (I accidentally wrote partition)? Could it be it's mounted? In that case:

umount /dev/my-volumes/volume-1

Does it have any active snapshots?

Edit: try lvchange -an -v /dev/my-volumes/volume-1 and lvremove -vf /dev/my-volumes/volume-1.

Edit 2: please post 'lvs'.

Edit 3: Try this with some other problematic volume. It's not the cleanest option but according to this site it may work, and it's less problematic than rebooting anyway.

dmsetup remove my--volumes-volume--number
lvremove /dev/my-volumes/volume-number
link|improve this answer
It doesn't contain anything. It's not a partition. It's not mounted (any longer). No active snapshots. – Everett Toews May 5 '11 at 17:28
Well, what did you use it for? It may give us a clue as to what may be wrong. – Eduardo Ivanec May 5 '11 at 17:42
Added the info you requested to the question. It was being used as a volume for OpenStack Compute (aka Nova). I actually managed to remove it by going nuclear and rebooting the machine and then doing an lvremove. Way more drastic than I wanted to be. I still have some other volumes hanging around that I would like to get rid of without having to reboot so any help you can provide is appreciated. – Everett Toews May 5 '11 at 20:13
I've added something for you to try with some other problematic volume. – Eduardo Ivanec May 5 '11 at 20:48
Tried it. No luck. I also tried everything from wiki.davidjb.com/… (hence the "/dev/dm-1: read failed..." in some of my output) but that didn't work either. – Everett Toews May 5 '11 at 21:09
show 1 more comment
feedback

You probably have iet or tgt running (which one depends on what your iscsi_helper value is in /etc/nova/nova.conf, defaults to iet), and the service has an open filehandle. You can check which one by doing something like this (in my case it's tgt)

# fuser /dev/nova-volumes/volume-00000001
/dev/dm-5:           19155

# lsof | grep /dev/dm-5
tgtd      19155            root   12u      BLK              252,5         0t0    2531554 /dev/dm-5

If it's iet, stop the service by doing:

service iscsitarget stop

If it's tgt, stop the service by doing:

service tgt stop

You should then be able to delete your volumes.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.