In this quick article we are going to visit the steps on how to create or recreate VMware Disk Descriptor files. It might happen sometimes such files can get corrupted or in the worst case even missing from the Datastore. As a such this is causing errors to pop up like “File not Found” or “File does not exist” causing the VMware virtual disk flat file to be unusable.
There are other cases where knowing it’s possible to create them is very handy and powerful. And that would be the case for this article. In a nutshell I will be creating a new VMware Disk Descriptor file to support and start the installation of Nutanix CE edition as a nested install into VMware.
As a such it is possible to download for free the Nutanix CE edition and help the installation by creating an additional VMware Disk Descriptor file. More information to come on this very topic in the next articles.
So the purpose of this article is not just getting familiarity with this approach but also assist with the installation steps of Nutanix CE in our home lab.
In particular this procedure consists of a few easy steps:
- locate the directory where to create the VMware Disk Descriptor file
- get main info from VMware virtual disk flat file
- create a dummy VMware Disk Descriptor file
- edit the temporary VMware Disk Descriptor file to match the desired virtual disk flat file
For this exercise we’ll use the command line with the native VMware vSphere commands through an SSL connection to the vSphere Host. So let’s make sure before commencing work on this one to start the SSL service on the intended vSphere Host. If using a Windows OS to connect to the vSphere Host I would recommend using putty proving very quick and simple to use.
How to create a VMware Disk Descriptor file
As soon as we are connected to the vSphere Host which will run our Virtual Machine let’s locate the directory where to create the VMware Disk Descriptor file. Ideally this would be in the same location as per the rest of the files constituting the Virtual Machine. In my example I will create a new VMware Disk Descriptor file to support the Nutanix CE install. This in a nutshell is the location where I have copied the Nutanix CE flat-file already.
If we simply issue a list command like “ls -l” we can see the content of the Virtual machine folder. As expected we can see 3 files. As a matter of truth I have already created a new Virtual Machine to start installing Nutanix CE. But during the wizard on purpose i didn’t ad any disk. In fact the only virtual disk available is the “flat file”. More info in the dedicated article on Nutanix CE install on VMware!
What is important in this step is to get the controller type for the virtual disks and the actual size of the virtual disk flat file. We can get the first information from the *.vmx file. By running “vi” utility or “nano” we can read the information for the controller type attached to the virtual machine. The possible values are “lsisas1068”, “buslogic” or “lsilogic”. Typically the latter is the most popular.
The second information about the disk size is available from the list command as per screenshot below: 7444889600.
It is important to have this information as this one will help creating a new VMware Disk Descriptor file representing the correct virtual disk geometry for the flat file.
At this point we can simply issue the “vmkfstools” command to create a temporary or dummy virtual disk file. As per our example this would be something like:
“vmkfstools -c 7444889600 -a lsilogic -d thin temp.vmdk”
being “c” used for disk capacity, “a” for the adapter type and finally “d” to specify the output. By choosing thin deployment we are not wasting any more space but just a few megabytes. Also the operation will be a lot faster.
As expected if we run another list “ls -l” command we can definitely see two new files created. The new VMware Disk Descriptor file and the temp flat file. Arguably the temp file reports the same size as our original flat file!
At this point we don’t actually need the temp flat file. In fact we can proceed to its removal. We can simply run a
“rm -i temp-flat.vmdk”.
Another list command to verify the files in this directory. As anticipated we’ll now take the steps to edit and point the new VMware Disk Descriptor file to the existing flat file.
First we start by renaming the Disk Descriptor file to be more consistent. As per our example I will rename this to NOS.vmdk as per screenshot below.
At this point we can use either “vi” or “nano” utilities depending on the actual vSphere release (for some reasons nano is not present in the 6.0u3 release). The command is pretty simple:
“vi NOS.vmdk”.
There are two sections we need to tweak in this file. The first one is the “Extent Description”. In this case we need to change the actual name from “temp-flat.vmdk” to “NOS-flat.vmdk” as per our example.
The second section to edit is the “Disk Data Base” and in particular we just need to remove the line “ddb.thinProvisioned = 1” for the simple reason that as per our example the “NOS-flat.vmdk” is allocated.
Of course we can leave this option should the case be different.
“vi” editor is not one of the most intuitive or easy to use. At least this is not my preferred one! Nano is my choice for Unix based file systems. Unfortunately this one has been removed as of last update to vSphere 6.0u3.
I would recommend a quick read on this link about vi editor.
Commands I have used include:
“r” Enable replace characters from the cursor
“ESC” to exit the edit mode
“Shift + zz” to exit and save changes
As an alternative it is possible to use other text editor like notepad and similar. The inconvenience in this case is download/upload of the file plus making sure the new editor is using the correct character set encoding expected.
The screenshot below shows the final result for our scenario.
Again if we run a list command we can see the expected files. And that would be 4 of them.
Very interestingly when browsing the same directory using the vSphere Client we can only see 3 files. Effectively the VMware Disk Descriptor file is pointing at the flat file. The former is the one we’ll be using in the Virtual Machine configuration file.
This concludes a quick article on the steps on how to recreate a VMware Disk Descriptor file for our virtual machines. In the next articles we’ll see this file in action!
Add Comment