{"id":1692,"date":"2011-06-10T12:47:48","date_gmt":"2011-06-10T19:47:48","guid":{"rendered":"http:\/\/greg.porter.name\/wordpress\/?p=1692"},"modified":"2011-07-19T13:39:32","modified_gmt":"2011-07-19T20:39:32","slug":"use-storage-vmotion-to-properly-rename-a-virtual-machines-datastore","status":"publish","type":"post","link":"https:\/\/greg.porter.name\/wordpress\/?p=1692","title":{"rendered":"Use Storage vMotion to Properly Rename a Virtual Machine&#8217;s Datastore"},"content":{"rendered":"<p>I&#8217;ve been a VMware administrator for a while now, but a co-worked recently showed me this handy trick.\u00a0<span style=\"text-decoration: line-through;\"> This assumes that you can do a <a href=\"https:\/\/www.vmware.com\/products\/storage-vmotion\/overview.html\">Storage vMotion<\/a>, This requires you to have the <a href=\"https:\/\/www.vmware.com\/products\/vsphere\/buy\/editions_comparison.html\">right version of vSphere<\/a>, like Enterprise or Enterprise Plus.<\/span> (Well, not exactly&#8230;\u00a0 As Joe points out below, if you turn the machine off or suspend it first, you can do this with Standard as well.)<\/p>\n<p>In vCenter, you can easily rename a virtual machine.\u00a0 You just right click on the machine and pick &#8220;Rename&#8221;.\u00a0 Every virtual machine consists of a folder and files in a datastore.\u00a0 Unfortunately, right click, Rename does not change the actual names of any of the files or folders.\u00a0 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&#8217;t match the name of any known machine.\u00a0 Confusing!\u00a0 Read more to see the fix&#8230;<!--more--><\/p>\n<p>Here&#8217;s what this looks like.\u00a0 For sake of example, I made a machine named &#8220;old_name&#8221;.\u00a0 I then changed my mind and did a right click, &#8220;Rename&#8221; and changed the name to &#8220;new_name&#8221;.\u00a0 Now the names don&#8217;t match, you can see the datastore is still named &#8220;old_name&#8221;.<\/p>\n<p><a href=\"https:\/\/greg.porter.name\/wordpress\/wp-content\/uploads\/2011\/07\/vmware_rename1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-1689\" title=\"vmware_rename1\" src=\"https:\/\/greg.porter.name\/wordpress\/wp-content\/uploads\/2011\/07\/vmware_rename1-1024x727.png\" alt=\"vmware_rename1\" width=\"491\" height=\"349\" srcset=\"https:\/\/greg.porter.name\/wordpress\/wp-content\/uploads\/2011\/07\/vmware_rename1-1024x727.png 1024w, https:\/\/greg.porter.name\/wordpress\/wp-content\/uploads\/2011\/07\/vmware_rename1-300x213.png 300w, https:\/\/greg.porter.name\/wordpress\/wp-content\/uploads\/2011\/07\/vmware_rename1.png 1125w\" sizes=\"auto, (max-width: 491px) 100vw, 491px\" \/><\/a><\/p>\n<p>To fix it, do a Storage vMotion.\u00a0 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.)<\/p>\n<p><a href=\"https:\/\/greg.porter.name\/wordpress\/wp-content\/uploads\/2011\/07\/vmware_rename2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1690\" title=\"vmware_rename2\" src=\"https:\/\/greg.porter.name\/wordpress\/wp-content\/uploads\/2011\/07\/vmware_rename2.png\" alt=\"vmware_rename2\" width=\"500\" height=\"419\" srcset=\"https:\/\/greg.porter.name\/wordpress\/wp-content\/uploads\/2011\/07\/vmware_rename2.png 927w, https:\/\/greg.porter.name\/wordpress\/wp-content\/uploads\/2011\/07\/vmware_rename2-300x250.png 300w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/a><\/p>\n<p>Once the Storage vMotion completes, you can see all the datastore names have been updated to the new name.\u00a0 Cool!<\/p>\n<p><a href=\"https:\/\/greg.porter.name\/wordpress\/wp-content\/uploads\/2011\/07\/vmware_rename3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-1691\" title=\"vmware_rename3\" src=\"https:\/\/greg.porter.name\/wordpress\/wp-content\/uploads\/2011\/07\/vmware_rename3-1024x727.png\" alt=\"vmware_rename3\" width=\"491\" height=\"349\" srcset=\"https:\/\/greg.porter.name\/wordpress\/wp-content\/uploads\/2011\/07\/vmware_rename3-1024x727.png 1024w, https:\/\/greg.porter.name\/wordpress\/wp-content\/uploads\/2011\/07\/vmware_rename3-300x213.png 300w, https:\/\/greg.porter.name\/wordpress\/wp-content\/uploads\/2011\/07\/vmware_rename3.png 1119w\" sizes=\"auto, (max-width: 491px) 100vw, 491px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve been a VMware administrator for a while now, but a co-worked recently showed me this handy trick.\u00a0 This assumes that you can do a Storage vMotion, This requires you to have the right version of vSphere, like Enterprise or&hellip; <a href=\"https:\/\/greg.porter.name\/wordpress\/?p=1692\" class=\"more-link\">Continue Reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1692","post","type-post","status-publish","format-standard","hentry","category-content"],"_links":{"self":[{"href":"https:\/\/greg.porter.name\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1692","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/greg.porter.name\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/greg.porter.name\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/greg.porter.name\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/greg.porter.name\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1692"}],"version-history":[{"count":25,"href":"https:\/\/greg.porter.name\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1692\/revisions"}],"predecessor-version":[{"id":1717,"href":"https:\/\/greg.porter.name\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1692\/revisions\/1717"}],"wp:attachment":[{"href":"https:\/\/greg.porter.name\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1692"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/greg.porter.name\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1692"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/greg.porter.name\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1692"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}