• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Yellow Bricks

by Duncan Epping

  • Home
  • ESXTOP
  • Stickers/Shirts
  • Privacy Policy
  • About
  • Show Search
Hide Search

Orphaned vmdk’s

Duncan Epping · Jan 16, 2009 ·

While doing a “mini-healthcheck” at a customer site I noticed a specific Datastore with less than 2% of free diskspace. After a bit of research an orphaned VMDK was found. Orphaned vmdk’s are virtual hard-disks that are not connected to a VM. Probably because they were removed from the inventory without deleting the files.

You can easily find these orphaned vmdk’s via the Service Console:

find -iname “*-flat.vmdk” -mtime +7

For those that don’t like using the Service Console you can also check this with Powershell Ad van Bokhoven created a nice script which he describes as follows:

This script asks the virtual center what the disk are of each VM and puts this into an array. After this, it reads all files on all datastores. If the file is a vmdk file, it will check wheter this file is in the array. If it’s not, you’ve found a orphaned vmd.

I would advise to regularly check your environment on orphaned disks, it can save precious diskspace.

Share it:

  • Tweet

Related

Management & Automation, Server powershell, Scripting, service console, Storage, vmdk

Reader Interactions

Comments

  1. Arnim says

    16 January, 2009 at 09:19

    If you have multiple clusters you can use plink.exe to execute this script on each cluster and redirect output to a file. You can also schedule this task if you like.

  2. mpoore says

    16 January, 2009 at 09:30

    I was going to work out how to do this today. It’s like you read my mind. Thank you.

  3. Duncan Epping says

    16 January, 2009 at 12:52

    You can use plink indeed… or just the powershell script.

  4. Garry says

    16 January, 2009 at 15:06

    find -iname “*-flat.vmdk” -mtime +7

    This could find some valid vmdk from VMs that haven’t been power on in a week,doesn’t it?

  5. Duncan says

    16 January, 2009 at 18:16

    that’s correct, you will need to verify the list. but it’s a good indication.

  6. Garry says

    16 January, 2009 at 20:16

    Yes, anyway, that command is a VERY good indication

  7. ToddH says

    20 January, 2009 at 17:33

    What should I see for an output? When I run the command on all our ESX Hosts I am dropped back to #.

  8. Duncan says

    20 January, 2009 at 17:39

    No result means no orphaned vmdk’s!

  9. ToddH says

    20 January, 2009 at 18:11

    Great — then call me “lucky”.

  10. bsr says

    18 March, 2010 at 03:00

    Hai,

    I want find the vmdk files alignment status from one of my cluster environment. The cluster having 110 VMs. So how can i find the all VMDK file alignment status from virtual center console .

    If any share this its great help …..

    Thanks & Regards,
    BSR Krishna

  11. bsr says

    18 March, 2010 at 03:28

    How to check the un aligned vmdk status from virtual center console

  12. bsr says

    18 March, 2010 at 03:29

    How to check the un aligned multiple vmdk status from a data store .

  13. bsr says

    18 March, 2010 at 03:57

    How to check the un aligned multiple vmdk status from a data store and Virtual center console

    Rgds,
    BSR

  14. raj says

    13 March, 2012 at 09:23

    what about template vmdk?

  15. John White says

    4 October, 2012 at 16:41

    One consideration is that this will also find vmdk’s on VM’s with a 1+ week old snapshot present.

    Not that that’s a bad thing since finding and removing old snapshots is great, just be warned that the output of this command won’t give you a confirmed list of junk vmdk’s. Check before you delete!

  16. M. Langhard (@Langhard) says

    16 October, 2014 at 14:37

    This is still relevant, so thank you for that post!
    Just be careful with the quotation marks. You may need to replace these “ with these ” to make this command work on your machine.

Primary Sidebar

About the author

Duncan Epping is a Chief Technologist in the Office of CTO of the Cloud Platform BU at VMware. He is a VCDX (# 007), the author of the "vSAN Deep Dive", the “vSphere Clustering Technical Deep Dive” series, and the host of the "Unexplored Territory" podcast.

Upcoming Events

Feb 9th – Irish VMUG
Feb 23rd – Swiss VMUG
March 7th – Dutch VMUG
May 24th – VMUG Poland
June 1st – VMUG Belgium

Recommended Reads

Sponsors

Want to support Yellow-Bricks? Buy an advert!

Advertisements

Copyright Yellow-Bricks.com © 2023 · Log in