> For the complete documentation index, see [llms.txt](https://platform9.com/kb/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://platform9.com/kb/pcd/storage/how-to-delete-volume-attached-to-stale-vm.md).

# How to Delete Volume Attached to Stale VM?

## Problem <a href="#environment" id="environment"></a>

A Persistent Storage volume cannot be deleted because it is still marked as **attached to a VM**, but:

* The VM is **deleted / missing / stale**
* The attachment is **orphaned**
* Standard delete fails with errors like:

{% code overflow="wrap" %}

```
$ openstack volume delete <VOLUME_UUID>
Failed to delete volume with name or ID '[VOLUME_UUID]': 
Invalid volume: Volume is in status 'in-use', expected one of ('available', 'error', 'error_restoring', 'error_extending', 'error_managing'). 
(HTTP 400) (Request-ID: [REQ_ID])
```

{% endcode %}

## Environment <a href="#environment" id="environment"></a>

* Private Cloud Director Virtualization - v2025.4 and Higher
* Self-Hosted Private Cloud Director Virtualization - v2025.4 and Higher
* Component: Storage Service

## Cause <a href="#cause" id="cause"></a>

This usually happens due to:

* Failed VM deletion
* Incomplete detach workflow
* Messaging issues (RabbitMQ / Persistent Storage / Compute Service sync gap)
* DB state inconsistency between **Persistent Storage** and **Compute Service**

## Diagnostics <a href="#diagnostics" id="diagnostics"></a>

* **Step 1: Identify the Volume**

  <pre data-overflow="wrap"><code>$ openstack volume show &#x3C;VOLUME_ID>
  </code></pre>

  * *Check:*

    **status** -> likely `in-use`\
    **attachments** -> contains stale server UUID
* **Step 2: Verify VM Existence**

  <pre data-overflow="wrap"><code>$ openstack server show &#x3C;VM_ID>
  </code></pre>

  * Check:&#x20;

    Not found -> stale attachment confirmed

## Resolution <a href="#resolution" id="resolution"></a>

1. Force the volume to an available state for Persistent Storage to ignore the stale VM

   <pre data-overflow="wrap"><code>$ openstack volume set --state available &#x3C;VOLUME_UUID>
   </code></pre>
2. Delete the stale attachment:

   ```
   $ openstack volume attachment delete <ATTACHMENT_UUID>
   ```
3. Delete the volume:

   ```
   $ openstack volume delete <VOLUME_UUID> --force
   ```

## Validation <a href="#validation" id="validation"></a>

* The volume is deleted successfully

{% code overflow="wrap" %}

```
$ openstack volume show <VOLUME_ID>
No volume with a name or ID of '[VOLUME_ID]' exists.
```

{% endcode %}

{% hint style="info" %}
Below step is applicable for Self-Hosted Private Cloud Director Users who can access the persistent storage and compute service databases.&#x20;
{% endhint %}

* No stale entries present in the following tables:
  * `volume_attachment`&#x20;
  * `nova.block_device_mapping`


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://platform9.com/kb/pcd/storage/how-to-delete-volume-attached-to-stale-vm.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
