In this FREE six-day email course, you'll learn from Janis Griffin, Database Performance Evangelist. She'll teach 12 steps that you can use to optimize your queries as much as possible and see measurable results in your work. Get started today!
First, what is a VMDK file in a virtual machine?
The disk description file or .vmdk, is a metadata file that contains data that describe the geometric characteristics and size of the disk where the data will be stored.
A virtual disk is made up of two files:
• File descriptor, its extension is (.vmdk).
• Flat file, where the data is saved, its extension is (flat.vmdk).
Example of a VMDK descriptor file (See image 1.0).
1.0.Parameters of a VMDK file.
I explain a summary of the origin of the problem:
In my virtual environment we currently have several virtual servers configured with the SCSI-Bus Sharing controller, which allows sharing virtual disks between virtual machines.
One of the limitations of this controller is that it does not allow vmotion with the virtual machine on, which is why we proceeded to turn off the server to perform the migration.
Once I made the migration of the virtual machine I proceeded to turn it on, but the following error appeared (See images 1.1 and 1.2).
1.1. When turning on the virtual machine, it indicates the following error:
1.2. Validating server events, it indicates the following:
Validating the datastore where the server is hosted, I could see that the VMDK file was not present, which is why it prevents me from turning on the virtual machine. (See images 1.3).
1.3.Virtual machine without the VMDK file present in the Datastore.
Throughout the article I will describe the steps to recreate the VMDK file of the virtual machine.
Activate the SSH service on the ESXi Host:
1.1.Select the ESXi, click on the Manage option.
1.2.Select Security Profile - Click on Edit.
1.3.Select SSH option. It can be seen that the SSH service is stopped.
Click on Start.
1.4.The SSH service is running. Click on OK.
1.5.In the task bar you can see that the SSH service started.
1.6.Login via SSH to the ESXi Host,using Putty. Enter the IP address of the ESXi.
Re-create the missing VMDK File Descriptor:
1.1. Enter via SSH to the ESXi where the affected virtual machine is hosted. Enter credentials
Go to the path where the virtual machine is stored. See attached image.
1.2. Once on the route, enter the command ls -lah, to validate the virtual machine records.
1.3. Enter the command less * .vmx | grep -i virtualdev To validate the VM controller.
1.4. Enter the command ls -l followed by the name of the vm along with the extension flat.vmdk.
To validate the Id of the disk.
1.5. We will carry out a cloning with the vmkfstools utility, to create a temporary file of the virtual disk, as it is visualized in the image.
-c: Indicates cloning the disk - Id of the disk.
-a: Type of virtual controller.
-d: Type of disk format
1.6. Go to the Datastore where the VM is stored and validate the creation of the temp.vmdk registry.
1.7. Validate the file system of the VM, and validate that the records are found:
temp-flat.vmdk and temp.vmdk. As shown in the picture.
1.8. Enter the command mv -i temp.vmdk followed by the name of the VM, to enter the registry. See attached image.
1.9. The parameters of the temp-flat.vmdk record are displayed.
2.1. Go to the Extent description parameter.
Replace the name temp-flat.vmdk with the name of the VM "VEPPHFEX12-flat.vmdk"
2.2. Enter the command rm -i to remove the temporary record. Press the "Y" key, to confirm the deletion. See attached image.
2.3. Go to the Datastore where the VM is stored and validate the creation of the disc descriptor record VEPPHFEX12.vmdk.
2.4. Enter the vi command to enter the disc descriptor record.
2.5. Move to the The Disk Data Base parameter.
2.6. Select the parameter ddb.thinProvisioned = "1" and delete it.
2.7. The parameter was removed, it is no longer found in the descriptor file.
2.8. Execute the vmkfstools -e command to check the consistency of the virtual disk.
Example: vmkfstools -e VEPPHFEX12.vmdk.
2.9. Go to the inventory of the vCenter and turn on the VM.
3.0. It is displayed in the inventory that the VM is on.
3.1. Click on Launch Console to validate that the operating system starts.
3.2. It can be seen that the operating system started without problems.
Congratulations, your virtual disk has been rebuilt and your VM can now be turned on without problems.