Use Storage vMotion to Properly Rename a Virtual Machine’s Datastore

I’ve been a VMware administrator for a while now, but a co-worked recently showed me this handy trick.  This assumes that you can do a Storage vMotion, This requires you to have the right version of vSphere, like Enterprise or Enterprise Plus. (Well, not exactly…  As Joe points out below, if you turn the machine off or suspend it first, you can do this with Standard as well.)

In vCenter, you can easily rename a virtual machine.  You just right click on the machine and pick “Rename”.  Every virtual machine consists of a folder and files in a datastore.  Unfortunately, right click, Rename does not change the actual names of any of the files or folders.  So if you use rename every now and then, and you have lots of virtual machines, you can easily get into a situation where there are lots of datastores with lots of virtual machine files and folders that don’t match the name of any known machine.  Confusing!  Read more to see the fix…

Here’s what this looks like.  For sake of example, I made a machine named “old_name”.  I then changed my mind and did a right click, “Rename” and changed the name to “new_name”.  Now the names don’t match, you can see the datastore is still named “old_name”.


To fix it, do a Storage vMotion.  I usually migrate the virtual machine to some other temporary datastore just to get the rename, and then back to the original datastore (so it winds up where it started.)


Once the Storage vMotion completes, you can see all the datastore names have been updated to the new name.  Cool!



One Comment

  1. That is a nice little trick I learned by chance a few months ago doing basically the same thing. It can be done with VSphere Standard as well, however you must power off or suspend the VM first.

Leave a Reply

Your email address will not be published.