> For the complete documentation index, see [llms.txt](https://docs.platform9.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.platform9.com/private-cloud-director/virtualized-clusters/virtualmachine/delete-vm-and-associated-resources.md).

# Delete a VM and Its Associated Volumes and Ports

## Overview

When you delete a virtual machine, <code class="expression">space.vars.product\_name</code> can also delete the volumes and ports that VM uses, in the same operation, instead of leaving them behind for you to clean up separately.

This behavior is optional. A plain VM deletion, as described in [Delete VM](/private-cloud-director/virtualized-clusters/virtualmachine/virtual-machine-actions.md#delete-vm), removes the VM, its ephemeral disks, and any volumes or ports that are already marked for removal when the VM is deleted, such as a volume with delete-on-termination enabled or an automatically created port like a DHCP port. To also remove volumes and ports that aren't already marked that way, use the **Also delete associated resources** option described on this page.

In this guide, you will delete one or more VMs together with some or all of their associated volumes and ports, and review the results of that deletion.

## Delete VMs with Associated Resources

1. In the VM grid view, select the VM or VMs you want to delete, then choose **Delete** from the Actions menu. You can also delete a single VM from its details page by choosing **Delete** in the page header.
2. In the **Delete 1 Virtual Machine** (or **Delete N Virtual Machines**, for a batch delete) dialog, review the warning that this action cannot be undone.

   The dialog also shows how many volumes and ports are associated with the selected VMs, as **Associated volumes: N** and **Associated ports: N**.

   <div data-gb-custom-block data-tag="hint" data-style="info" class="hint hint-info"><p><strong>Info</strong></p><p>If a volume being deleted has a dependent snapshot, deletion takes longer to complete.</p></div>
3. Choose how to handle the associated resources:
   * Leave **Also delete associated resources** unchecked to delete only the selected VM(s); volumes and ports already marked for removal are still deleted, but other associated volumes and ports are kept.
   * Check **Also delete associated resources** to delete the VM(s) along with every associated volume and port.
   * Click **Select Resources** to open a detailed selection view and choose exactly which volumes and ports to delete, instead of all or none. See [Select Specific Resources to Delete](#select-specific-resources-to-delete) below.
4. Confirm the deletion. If you opened the detailed selection view, click **Delete VMs & Resources** there instead; see the next section.

## Select Specific Resources to Delete

Click **Select Resources** in the delete dialog to choose exactly which associated volumes and ports are removed, rather than deleting all of them or none.

The detailed selection view's subheader shows the scope of the operation: **VMs: N**, **Selected volumes: N**, and **Selected ports: N**. An info banner reminds you that selected resources will be deleted with the VMs, and that all associated volumes and ports are selected by default, so you should deselect any resources you want to keep.

**Volumes.** The **Volumes selected for deletion** table lists every volume attached to the selected VMs, with its Name, Type, VM, Device, Size, and whether it's bootable. Every volume is selected by default; clear a row's checkbox to keep that volume instead of deleting it.

A volume that's already configured to delete when its VM is deleted can't be deselected here. Its checkbox is locked, with the tooltip:

> This volume is already marked for deletion within volume termination settings

If none of the selected VMs have any attached volumes, the table shows **No volumes associated with the VM(s)** instead.

**Ports.** The **Ports selected for deletion** table lists every port attached to the selected VMs, with its Name, Network Name, IP Address, and VM. Every port is selected by default; clear a row's checkbox to keep that port instead of deleting it.

A port that <code class="expression">space.vars.product\_name</code> created automatically, such as a DHCP port, can't be deselected. Its checkbox is locked, with the tooltip:

> This is a DHCP port and will be automatically deleted

If none of the selected VMs have any attached ports, the table shows **No ports associated with the VM(s)** instead.

When you've finished adjusting the selection, click **Delete VMs & Resources** to confirm.

## Review the Results

After the deletion runs, <code class="expression">space.vars.product\_name</code> reports how many resources were deleted, for example **N resources deleted**. If any resource failed to delete, it instead reports **Some resources weren't deleted due to an error**.

Click **Show Details** to see a per-resource breakdown, listing each VM, volume, and port with its individual result, Deleted or Failed.

## Related Pages

* [Virtual Machine Actions](/private-cloud-director/virtualized-clusters/virtualmachine/virtual-machine-actions.md): the Delete VM action that opens this dialog
* [Port](/private-cloud-director/virtualized-networking/port.md): what a port is and how it attaches to a VM
* [Block Storage](/private-cloud-director/storage/block-storage.md): persistent storage volumes that can be deleted through this flow


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.platform9.com/private-cloud-director/virtualized-clusters/virtualmachine/delete-vm-and-associated-resources.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
