4 Steps to Find and Remove Orphaned Disks in VMware Vcenter

Disk space can seem like an ongoing battle in many virtual environments. In this post I’m going to be showing you one way of dealing with orphaned disks within VMWare’s Vcenter in order to free up any “lost” storage.

First off, what is an orphaned disk? Well it’s fairly simple, ever deleted a disk from a virtual machine (VM) and not removed it from the datastore? Well congratulations, you have just created an orphaned disk! Orphaned disks are not attached to any VM within the Vcenter environment. In most cases that means we don’t want the disk, however there may be exceptions so before you run ahead and delete everything check that your orphaned disks aren’t shall we say, applying for adoption!

Pre Requisites:

  • PowerGUI – Download Here
  • PowerGUI – VMWare PowerPack (Included with PowerGUI)
  • VMware vCenter

To search our environment for orphaned disks we will be using the PowerGUI Administrative Console. Open the console from the start menu. We will be using the VMWare PowerPack. In the navigation tree window on the left hand side if you don’t see a “VMWare” tree then we need to enable the PowerPack, if you do the skip the next section.

1 – Enable the VMWare PowerPack

In the PowerGUI administration console browse to “File” > and click “PowerPack Management” Click “Import” and browse to “C:\Program Files (x86)\PowerGUI\PowerPacks” Select “VMware.VIToolkit.powerpack” click “Open” that’s it! Close the PowerPack Management window.

2 – Connect PowerGUI to vCenter

Expand the “VMware” tree and select “Managed Hosts” On the right hand menu click “Add Managed Host…” you are presented with the parameter window, here enter the FQDN name (or IP Address) of your vCenter server. Configure your account details and click “OK”

Your newly added vCenter host appears in the managed window, highlight your host and from the actions pane click “Connect”

3 – Run the Report

In the Navigation Tree (left hand pane of PowerGUI) Under VMWare\DBest Practice Queries \Disk Queries select “Orphaned VMDK files. Depending on the size and perfomrance of your environment the query will take some time to complete. You will notice at least one esxconsole-<hashed Number>.vmdk DO NOT DELETE THESE FILES.PowerGUI and the VMware PowerPack

4. Remove the Disks

After you have verified that the orphaned disks are genuinely no longer required it’s time to reclaim that disk space.

You could do this via Powershell and PowerCLI or even using PowerGUI but for the purpose of this article we will fire up vCenter and navigate to our datastore. From the “Home” page click “Datastores” .

Open the datastore containing the orphaned .vmdk file you wish to remove. Browse the contents of the datastore by right-clicking the datastore and selecting “Browse Datastore…”

In the datastore browser window navigate to the correct disk and select it in the main window. Check the name carefully, now is not a good time to delete the wrong disk! Select the disk and clik the red X on the menu bar of the datastore browser. You will be promted to confirm your actions! Congratulations you just removed an orphaned disk, now on to the next!