Unable to rename a virtual machine folder on vSAN Datastore
search cancel

Unable to rename a virtual machine folder on vSAN Datastore


Article ID: 326511


Updated On:


VMware vSAN


  • 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>


Renaming of virtual machine folders on vSAN Datastore is currently not supported.


To work around this issue, use one of these options:

Option 1: Rename the VM Namespace object using objtool from ESXi CLI:
  1. Unregister virtual machine from the vCenter Server.
  2. Connect to ESXi host via SSH and navigate to the vSAN datastore:

    For Example: $ cd /vmfs/volumes/vsan:526a4992690a4ca5-3bc96c7f056d7fd1
  3. 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 -> cf9b6e55-422c-23ba-c7da-b8ca3af6a80e
    Note: In the above example, the Namespace uuid is cf9b6e55-422c-23ba-c7da-b8ca3af6a80e.
  4. 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 cf9b6e55-422c-23ba-c7da-b8ca3af6a80e -n "NewTestVM"
    Object set attribute succeeded
  5. The old virtual machine folder (TestVM) would now be renamed to NewTestVM

    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
  6. Register the virtual machine from the new folder using Datastore Browser.
Option 2: Rename VM folder using Datastore Browser
  1. Power-Off the virtual machine.
  2. Un-register the virtual machine from vCenter Server Inventory.
  3. Create a new directory on the vSAN Datastore with the name virtual machine has to be renamed.
  4. Move or copy the virtual machine files to the new directory using the Datastore browser.
  5. 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 and ESX (1029513)

Additional Information