Verifying ESX/ESXi virtual machine file integrity (1003743)
This article describes the various files that make up a virtual machine running on an ESX host. It also provides information on how the integrity of these files may be compromised and the various means of resolving the resulting problems.
Types of files
floppy0.startConnected = "false"
floppy0.clientDevice = "true"
This is a supplemental configuration file for virtual machines.
VMDK and -flat.VMDK Files
VMDK Delta Files
This is a centralized file for storing information and metadata about a snapshots of a virtual machine.
This file contains the BIOS of the virtual machine.
Renaming a virtual machine
Commit any snapshots.
Shutdown the virtual machine.
If you are using vCenter Server, remove the virtual machine from the inventory but do not delete the files from disk.
Connect to the ESX host on which the virtual machine resides over SSH. For more information, see Opening a command or shell prompt (1003892).
Unregister the virtual machine.
For ESX, run this command:
vmware-cmd -s unregister <path to config file>
Where <path to config file> is the path to the configuration file as determined by the vmware-cmd –l command. For more information on the vmware-cmd –l command, see the VMware Scripting API.
vmware-cmd -s unregister '/vmfs/volumes/storage1/vm1/vm1.vmx'
Log in to the ESXi host where the virtual machine is registered. For more information, see:
Tech Support Mode for Emergency Support (1003677) for ESXi 3.5 and ESXi 4.0
Using Tech Support Mode in ESXi 4.1 and ESXi 5.x (1017910) for ESXi 4.1 and above.
- Unregister the virtual machine with the CLI commands:
Note: The getallvms command should return the vmid of the virtual machine to be unregistered.
# vim-cmd vmsvc/getallvms
# vim-cmd vmsvc/unregister vmid
Alternatively, unregister the virtual machine from vCenter Server inventory. To unregister, right-click the virtual machine and choose Remove from Inventory.
Rename the folder, .vmx file, and .vmdk (+ flat) file to match the new name:
mv /vmfs/volumes/storage1/vm1/ /vmfs/volumes/<perhaps new storage?>/NewVM/
cd /vmfs/volumes/<perhaps new storage?>/NewVM/
mv vm1.vmx NewVM.vmx
mv vm1.vmdk NewVM.vmdk
mv vm1-flat.vmdk NewVM-flat.vmdk
See Note below for alternative command for renaming the VMDK file: vmkfstools -E <oldName>.vmdk <newName>.vmdk
Edit the .vmx file to reflect the name of the new descriptor file.
Locate the scsi0:0.fileName line. It appears similar to:
scsi0:0.fileName = "vm1.vmdk"
The edit appears similar to:
scsi0:0.fileName = "NewVM.vmdk"
Save the file and exit.
Edit the .vmdk file to reflect the name of the new flat file.
Locate the Extent description section of the .vmdk file. It appears similar to:
# Extent description
RW 8388608 VMFS "vm1-flat.vmdk"
Edit this to:
# Extent description
RW 8388608 VMFS "NewVM-flat.vmdk"
Register the virtual machine.
For an ESX host run the command:
vmware-cmd -s register <path to config file>
Where <path to config file> is the path to the configuration file determined by the ‘vmware-cmd –l’ command.
vmware-cmd -s register '/vmfs/volumes/<perhaps new storage?>/NewVM/NewVM.vmx'
Add the virtual machine back into vCenter Server inventory using the vSphere/VMware Infrastructure Client by browsing the data store, finding the .vmx file, right-clicking and adding it to inventory.
vmkfstools -E <oldName>.vmdk <newName>.vmdk
This command renames the content file (-flat.vmdk ) and also all references inside the metadata file (.vmdk). Ensure to update your virtual machines .vmx file after completing this step.
Corrupt VMX File
- Error when deleting a snapshot: ASSERT /build/mts/release/bora-39823/bora/vmx/snapshot/snapshot_vmx.c:752
- Error when attempting to power on a virtual machine: "operation not allowed in the current state"
Connect to vCenter Server or your ESX host directly with the vSphere Client.
Remove the virtual machine from the inventory.
Right-click your ESX host and choose New Virtual Machine.
Select the Custom option.
Create the virtual machine with the same configuration it had before the migration.
When you get to the Select a Disk section, choose to Use an existing virtual disk, and point to the original .vmdk file(s).
Finish the creation of the virtual machine.
Power on the virtual machine.
The entries in the log file appear similar to:
Feb 28 18:11:47.799: vmx| DICT virtualHW.version = 4
Feb 28 18:11:47.799: vmx| DICT floppy0.present = TRUE
virtualHW.version = 4
floppy0.present = TRUE
Corrupt VMDK File
Ensure you have sufficient disk space on another VMFS volume to clone the virtual machine.
Connect to the virtual machine using remote desktop.
Download and install VMware converter inside the virtual machine.
This can also be downloaded to your own laptop, desktop, or another virtual machine as long as you have network access to both the source and destination.
Run Converter and select Physical Machine and Local Machine.
Choose an ESX Server host as a destination and select a healthy VMFS.
Follow the wizard and wait for the process to complete.
# dd if=/dev/sda of=/mnt/nfs/sda.dd bs=1024k
You must create a new virtual machine and boot it from CD to Linux rescue mode and restore the image:
# dd if=/mnt/nfs/sda.dd of=/dev/sda bs=1024k
Note: This method creates only crash consistent image.