Error: "A required file was not found" after manually renaming or moving virtual machine folder
search cancel

Error: "A required file was not found" after manually renaming or moving virtual machine folder

book

Article ID: 452165

calendar_today

Updated On:

Products

VMware vCenter Server

Issue/Introduction

Virtual machines (VMs) may appear as "inaccessible" or "invalid" in the vCenter inventory following a manual rename, or movement, of the VM folder on the datastore. If the VM is powered off, it will not power on again. Backup systems and snapshot operations fail with the following errors:

  • Error: Detected an invalid snapshot configuration
  • Error: A required file was not found

Symptoms: The vmware.log file indicates that the VM configuration process cannot locate the .vmx file because the path defined in the configuration does not match the actual folder structure on the datastore.

Example log entry:

text
 
OBJLIB-LIB: Failed to get VCFS root path vmx path /vmfs/volumes/<datastore_uuid>/<original_vm_name>/<original_vm_name>.vmx since vm folder name in the datastore is <new_vm_name> and not <original_vm_name>

Environment

VMware vCenter Server

Cause

Renaming, or moving, a virtual machine folder directly via the Datastore Browser or file system commands (such as mv or cp) updates the file system name but fails to update the internal references within the .vmx configuration file and disk descriptor files. vCenter attempts to locate files in the original directory, resulting in a "file not found" condition.

 

Resolution

Important: Never rename or move VM folders directly via the Datastore Browser. This feature does not update configuration references and will lead to VM inaccessibility.

Follow these steps to restore VM accessibility:

  1. Verify File Locks: Before modifying any files, confirm that no ESXi host holds a lock on the VM files. Run the following commands via SSH on an ESXi host:

    bash
     
    for file in *; do vmfsfilelockinfo -p "$file" | awk '{FS = "\n"; RS = ""} {print $2 , $7}'; donels | while read x; do vmfsfilelockinfo -p "$x"| grep "is locked"; done
  2. Unregister the VM: In the vSphere Client, right-click the inaccessible virtual machine and select Remove from Inventory.

  3. Correct the Path Mismatch:

    • Option A: Rename the datastore folder back to the original name that matches the configuration.
    • Option B: If the folder must remain renamed, manually edit the .vmx file and update the scsi0:0.fileName paths to reflect the new directory structure.
    • Note: Do not use mv or cp to rename or move virtual disks. If renaming virtual disks is required, use vmkfstools -E <old_name.vmdk> <new_name.vmdk>.
  4. Re-register the VM:

    • Navigate to the Datastore Browser.
    • Locate the .vmx file in the correct directory.
    • Right-click the file and select Register VM.
  5. Verify: Power on the VM to ensure the configuration is loaded correctly. Trigger a snapshot or backup task to confirm the A required file was not found error is resolved.

Additional Information