TECH::Uh, I didn’t put that VM there… #vExpert

Ever find yourself browsing vSphere and seeing a VM show up on a datastore you *know* you didn’t put that VM in? I’ve run into this issue a few times and never have seen a KB or blog post on it. Closest I’ve seen is this one:

In VMware vCenter Server 5.x a virtual machine with a snapshot displays datastores or port groups that are no longer in use

If you’ve ever run into this issue, you know how irritating and maddening it can be. Forehead-smashing even. One of my co-workers/co-lab admins ran into this a couple weeks ago, so I decided to blog it up.

For example, in my vSphere, I have a datastore mounted (via NFS on clustered Data ONTAP, of course!) that contains ISO images for my VMs to use for installs, upgrades, etc. But I don’t ever create VMs on it. In fact, I’ve got roles set to disallow creating VMs. However, when I browse to it…

vsphere-datastore

And when I look at the datastore where that VM is *supposed* to exist…

vsphere-datastore2

So what gives? Why is my VM, which I am certain only exists once, showing up in multiple places, including a datastore where I can’t/don’t create VMs?

The answer? @#$^! snapshots.

The datastore that is showing an extra VM is my ISO datastore. As I mentioned, it hosts my ISO images that I mount to VMs. In this case, my Centos 6.5 image has an ISO mounted.

snapshot-iso

When I took a snapshot of the VM in vSphere, that meant it took a snapshot of the VM with an ISO mounted. To do that, it had to include information about the ISO in the snapshot, which means it “added” the VM to the ISO datastore.

snapshot-manager

So how do I fix it?

Simple – delete the snapshot. If you want a snapshot of the VM that doesn’t do this, unmount the ISO before taking a snapshot. And, as a best practice, unmount your ISOs when you’re done with them. (Put your toys away where you found them!)

After I delete the snapshot, the VM still shows up in the ISO datastore, because I have not unmounted the ISO yet. Once I unmount the ISO, the VM disappears from the datastore…

vm-removed

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s