Unable to rename a virtual machine folder on vSAN Datastore
book
Article ID: 326511
calendar_today
Updated On:
Products
VMware vSAN
Issue/Introduction
Symptoms:
Renaming a virtual machine folder on vSAN (formerly known as Virtual SAN) Datastore using Datastore Browser does not work.
The virtual machine is already unregistered from the vCenter Inventory.
Rename task fails with error:
Error caused by file [vsanDatastore] <VM Name>
Cause
Renaming of virtual machine folders on vSAN Datastore is currently not supported.
Resolution
To work around this issue, use one of these options:
Option 1: Rename the VM Namespace object using objtool from ESXi CLI:
Unregister virtual machine from the vCenter Server.
Connect to ESXi host via SSH and navigate to the vSAN datastore:
For Example: $ cd /vmfs/volumes/vsan:526a4992########-######7f056d7fd1
List the contents of the datastore and take note of Namespace UUID of the virtual machine.
$ ls -l lrwxr-xr-x 1 root root 36 <DATE><time> TestVM -> ########-####-####-####-########a80e </time>Note: In the above example, the Namespace uuid is ########-####-####-####-########a80e.
Run the below command to create a new folder with the Namespace UUID.
For the above example, run: $ /usr/lib/vmware/osfs/bin/objtool setAttr -u ########-####-####-####-########a80e -n "NewTestVM" Object set attribute succeeded
The old virtual machine folder (TestVM) would now be renamed to NewTestVM
Note: Replace the Namespace UUID with the one in your setup. There might be a delay of few minutes in reflecting this change. To refresh immediately restart the vSAN OSFSD service from SSH by running the command /etc/init.d/osfsd restart
Register the virtual machine from the new folder using Datastore Browser.
Option 2: Rename VM folder using Datastore Browser
Power-Off the virtual machine.
Un-register the virtual machine from vCenter Server Inventory.
Create a new directory on the vSAN Datastore with the name virtual machine has to be renamed.
Move or copy the virtual machine files to the new directory using the Datastore browser.
Re-register the virtual machine using the VMX file in the new virtual machine folder.
Option 3: Rename VM folder using Storage vMotion
Note: This option can be used if no downtime is available for the virtual machine.
Use storage vMotion (requires another datastore - VMFS or NFS) to migrate the virtual machine to a new location and then migrate it back to vSAN Datastore. For more information, see Renaming a virtual machine and its files in VMware ESXi