How to Rename a VM Folder and Files in the ESXi Shell (ESXi 7/8)

Updated for 2026: originally written on ESXi 6.5, for the case where Storage vMotion isn’t available (no license, no vCenter, or a standalone host). The procedure is the same on ESXi 7 and 8. If you do have vCenter, just rename the VM in the inventory — that renames the files automatically on the next Storage vMotion. This is the manual version for when you can’t.

The rules before you start

  • The VM must be powered off. Every step below assumes it.
  • Take note of the VM’s current name and datastore — you’ll unregister it during the process, and your notes are the way back if something goes sideways.

1. Unregister the VM

In the host client or vSphere Client: right-click the VM → Unregister (not “Remove from disk” — that deletes it). This matters: with the VM registered, ESXi keeps handles on the files you’re about to rename.

2. SSH in and rename the folder

[root@esxi1:~] cd /vmfs/volumes/datastore1
[root@esxi1:~] ls
oldname  other-vm  ...

[root@esxi1:~] mv oldname newname
[root@esxi1:~] cd newname

3. Rename the files inside

Everything except the disk first — the small files are plain renames:

[root@esxi1:~] mv oldname.nvram newname.nvram
[root@esxi1:~] mv oldname.vmsd  newname.vmsd
[root@esxi1:~] mv oldname.vmx   newname.vmx
[root@esxi1:~] mv oldname-1234.hlog newname-1234.hlog   # if present

The disk is the exception. Never mv a .vmdk — a VMDK is a descriptor file pointing at a -flat.vmdk extent, and the descriptor contains the extent’s name. Use vmkfstools, which renames both and fixes the descriptor:

[root@esxi1:~] vmkfstools -E oldname.vmdk newname.vmdk

Repeat for every disk and snapshot delta disk the VM has (oldname-000001.vmdk and friends, if snapshots exist — better yet, consolidate snapshots before you start).

4. Fix the references in the .vmx

[root@esxi1:~] vi newname.vmx

Update every occurrence of the old name: displayName, the scsi0:0.fileName entries for each disk, nvram, and any extendedConfigFile references. A fast check afterwards:

[root@esxi1:~] grep -i oldname newname.vmx   # should return nothing

5. Re-register and power on

Either from the host client (Datastore browser → right-click newname.vmx → Register VM), or from the shell:

[root@esxi1:~] vim-cmd solo/registervm /vmfs/volumes/datastore1/newname/newname.vmx

Power the VM on. If it asks whether you moved or copied it, answer “I Moved It” — that preserves the UUID and MAC addresses, so the guest’s network config and licensing don’t notice the surgery.


Running your own server? These guides assume you have a Linux box somewhere — see our guide to choosing a VPS in 2026 for the 7 specs that actually matter before you spin one up.

Scroll to Top