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:
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…
And when I look at the datastore where that VM is *supposed* to exist…
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.
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.
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…