Frequently Asked Question

Removing an Orphaned Disk in Proxmox
Last Updated 6 months ago

Occasionally, a virtual machine disk in Proxmox may become 'orphaned', meaning its corresponding VM no longer uses it, but the Proxmox UI prevents its deletion due to safety mechanisms. This guide outlines the steps to safely identify and remove such disks.

Important Note: Proceed with extreme caution. Incorrectly deleting a disk can lead to data loss and system instability. Always double-check each step.

1. Identify the Orphaned Disk

First, identify the disk you suspect is orphaned using the pvesm list command. You will need to specify the storage ID and can filter by VM ID.

For example, to list disks associated with VM 105 on the local-lvm storage:

pvesm list local-lvm | grep vm-105

This might return output similar to:

local-lvm:vm-105-disk-0   raw     images    2199023255552 105
local-lvm:vm-105-disk-1   raw     images    2199023255552 105

In this example, we identify vm-105-disk-0 and vm-105-disk-1. For the purpose of this guide, let's assume vm-105-disk-0 is the orphaned disk.

2. Verify Disk is Not in Use (Crucial Step)

Before deleting, it is critical to confirm the disk is not in use by any other VM, clone, template, or backup.

2.1 Check for References in Proxmox Configuration Files:

Search through the Proxmox configuration directory for any references to the identified disk.

grep -r "vm-105-disk-0" /etc/pve/

If this command returns no output, it suggests the disk is not directly referenced in the main Proxmox configuration files.

2.2 Check the VM's Configuration for Unused Disks:

Inspect the specific VM's configuration for any unused disk entries. While the previous grep should catch this, it's a good dedicated check.

qm config 105 | grep unused

If this command returns output, inspect it carefully. Determine if the unused disk refers to the one you intend to delete, or if this also needs you attention. 

2.3 Confirm Active Disks for the VM:

Verify which disks are currently attached and active for the VM. This provides a definitive list of currently used disks.

qm config 105 | grep vm-105-disk

Example output:

scsi0: local-lvm:vm-105-disk-1,iothread=1,size=2T

This output confirms that vm-105-disk-1 is currently attached as scsi0 to VM 105. If vm-105-disk-0 does not appear here or in the other checks, it strongly indicates it is orphaned.

3. Remove the Orphaned Disk

Once you are absolutely certain the disk is not in use and is safe to delete, use the pvesm free command to remove it from the storage.

Warning: This action is irreversible and permanently deletes the disk and its data.

pvesm free local-lvm:vm-105-disk-0

Successful removal will typically display output similar to:

Removed volume local-lvm:vm-105-disk-0

The orphaned disk has now been safely removed from your Proxmox storage.



Proxmox support from the engineers who wrote this article

This article came out of a real case resolved by GEN engineers, not from upstream documentation. GEN have run Proxmox in production in our own UK data centres since 2015, and have been in enterprise IT for 37 years. If this one has not solved your problem, we can.

  • 30 minute response, 24 hours a day, every day of the year on critical production infrastructure.
  • No contracts. Buy hours, use hours. No minimum term and no notice period.
  • Genuinely independent. We hold no software partner status with Proxmox or any other vendor, so nothing we recommend is shaped by a licence margin.
  • UK based, in-house engineers. No outsourced first line.

Proxmox support  ·  VMware to Proxmox migration  ·  Proxmox training  ·  Support rates

Registering a GEN account is free, so the route to an engineer is open before you need it. You only ever pay for the time you use.

This website relies on temporary cookies to function, but no personal data is ever stored in the cookies.
OK
Powered by GEN UK CLEAN GREEN ENERGY

Loading ...