Deleting Stuck Cinder Volumes

April 15, 2016

Recently, I was using Kilo version of OpenStack and was trying to programmatically attach/detach volumes to an instance. Every once in a while, volumes would go to an ‘in-use’ state even after the instance was destroyed. In fact, even in other releases, I have seen cinder volumes stuck in in-use or error state and sometimes not being able to delete those.

If the volume is in ‘in-use’ status, you first have to change to an available status though before you can issue a delete:

cinder reset-state --state available $VOLUME_ID
cinder delete $VOLUME_ID

If ‘cinder delete’ doesn’t work and you have admin privileges, you can try force-delete.

cinder force-delete $VOLUME_ID

But may be that will fix it. May be it will not. If the volume is still stuck, try going to the database and setting the status of the volume to a detached state:

update volume_attachment set attach_status="detached" where id="<attachment_id>";
update volumes set attach_status="detached" where id="<volume_id>";

Once I did that, I was able to delete or force-delete any stuck volumes.

1 Comment on Deleting Stuck Cinder Volumes

Respond | Trackback

  1. wp says:

    Thank you. Worked great.