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

5 Answers 5

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

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

I got into similar situation, but removing of LV was blocked, because I was using mount -o bind.

The article below helped a lot, using lsof with major/minor numbers of LV showed process holding opened LV, in my case smbd.

Than just simply cat /proc/mounts | grep LV_name led me to conclusion, why lvremove or dmsetup remove refuse to get a rid of unmounted LV.

http://kb.eclipseinc.com/kb/why-cant-i-remove-a-linux-logical-volume/

share|improve this answer

If you are unable to unmount or lvremove a logical volume, verify that there are no processes holding the LV

Locate the major/minor numbers for the logical volume you’re trying to remove eg:vol0

# dmsetup info -c | grep vol0

Take note of the 5th column, which indicates if a volume is “open,” and the 2nd and 3rd columns, which are the major and minor IDs, respectively.

Find any process attached to this volume by searching on the major and minor IDs discovered above:

# lsof | grep "major,minor"

Shut down or kill any process still accessing the volume to continue unmounting and removal.

then try lvremove

share|improve this answer

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

lvremove ...

share|improve this answer

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.