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
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
andlvremove -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.
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
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:
Shut down or kill any process still accessing the volume to continue unmounting and removal.
then try lvremove
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/
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)If it's iet, stop the service by doing:
If it's tgt, stop the service by doing:
You should then be able to delete your volumes.
Shutdown the LXC containers that use the filesystems via their config : lxc.mount.entry
If you are unable to remove
lvm
, then please follow these steps:unmount the Partition:
# umount /dev/sda8
(eg. I have mounted the partition on
/dev/sda8
)try to remove
lvm
like so:# lvremove /dev/vgname/lvname
If you get an error like "can't remove open logical volume in linux", then try to deactivate the LVM through below commands and then remove it:
Let us know if you face any issue.
I had this problem with a LV that comes from 3 PVs on an iSCSI device (with multipathing).
No solution worked but a simple reboot! (comment it out in fstab, so it don't get mounted again)
Maybe that helps someone.
In my case I was running cAdvisor in a container, and this seems to prevent the removal of any block devices which were mounted when it started. My fix was:
docker restart $CONTAINER_ID
)this also might be locked by nfslock service in RHEL, just stop that service and the you are good to go.
I had a similar problem. The lv I tried to remove was a VM block device, holding a volumegroup. This volumegroup was filtered in lvm.conf, but some dev mapper items were created earlier.
To figure out was is hold by a device, look at its minor number (253, ??)
ll /dev/<vg>/<lv>
should point to../dm-??
Then
ls -la /sys/dev/block/253:??/holders
will give you links of vg (ex-> ../../dm-xx
) relaying on your device (as a pv)Remove them with
dmsetup remove /dev/dm-xx
(make sure that those dm are not used) Then you should remove /dev// which is no more a "pv" somewhere