Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question
add comment

4 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
share|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

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.

share|improve this answer
add comment
# fuser /dev/nova-volumes/volume-00000001
/dev/dm-5:           19155

# lsof | grep /dev/dm-5
share|improve this answer
1  
Welcome to Server Fault - we prefer answers to have some content as opposed to just posting a bunch of commands for people to blindly run. Please edit your answer to include some explanation of what you're doing and why it should help solve the problem described in the question. –  voretaq7 Jun 7 '13 at 3:27
add comment

I have the same problem as yours. I tried the following command and resolved: swapoff -a

lvremove ...

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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