Recently when I was working, I came across an issue wherein I was not able to perform svMotion from one datastore to another.
I then realised that the issue was with the missing vmdk file.
All of you must be aware that the virtual disk has two components associated with it. One is the descriptor file and the other flat file.
Descriptor file contains information related to the virtual disk associated with a Virtual Machine, whereas the flat file contains the actual data of the Virtual Disk.
In today's post, we will be looking at how to recreate missing vmdk file.
In my lab, I tried to recreate the problem and when tried to svMotion, I was presented with the below error message.
It is quite clear that the vmdk file was not found when it tried to svMotion the files from one datastore to another.
Let us now look at the components of the Virtual Machine directory.
In my lab, I have renamed the actual vmdk file to vmdkold to recreate the problem.
Now before we recreate the missing vmdk file, we need to first check the SCSI controller type in the configuration file of the virtual machine.
grep -i scsi *.vmx
This gives us information about the virtual disks that are attached the Virtual Machine and also the SCSI controller type.
Note that the SCSI controller type that we are using the LSILOGIC. We will be using this to create the missing vmdk in the next step.
Now let us see the properties of the flat file.
ls -l Router-flat.vmdk
We will note down the size of the file so that we can use the same in the next step.
We will now create a temporary vmdk file using vmkfstools using the details that we have from the previous steps.
vmkfstools -c 1073741824 -a lsilogic -d thin temp.vmdk
The above line will create the vmdk file and the associated flat-file of the same size as Router-flat.vmdk.
We will now delete the temp-flat.vmdk as we are interested only in the descriptor file.
rm -rf temp-flat.vmdk
We will nor rename the temp.vmdk to Router.vmdk in the next step.
mv temp.vmdk Router.vmdk
We are almost at the end of the process. We just have to edit our newly renamed Router.vmdk file to point to Router-flat.vmdk.
It is currently pointing to temp-flat.vmdk.
Using the vi editor, we can change to point to Router.vmdk as seen below.
Save the file and we should now be able to successfully svMotion the Virtual Machine to a different datastore.
I hope that this has been informative and thank you for reading!