Adding a new disk to Vmware Virtual machine with different datastore and creating the disk descriptor.

This article is ESX server specific and as per my experience, the scenario may be different for different setup.

Recently, i was trying to create a VM disk for one of the Virtual machine. I was assigning a different datastore for this disk, as it was impossible to use the Virtual machine’s datastore. I was getting the “timeout” error everytime and the was not getting created.

Then i created the VM disk using a different Virtual machine in the intended datastore and then moved it to a directory i created. Also ensured that i move two files of .vmdk extention. One of the file is a Disk descriptor file and the other one is a actual Disk file (Flat file).

Reattaching the disk was easy task then.

Creating the disk descriptor.

Secondly, it might happen that you move the Flat file only and loose the descriptor file. Vmware will not recognize the disk without the related descriptor file. Here is a method using which you can recreate the descriptor file easily.

  • e.g. you have a Flat VMDK file called as “Mydisk-flat.vmdk” with 80GB in size.
  • Create a new disk with some other name with following command. Ensure to mention the SCSI controller type correctly (lsilogic or Buslogic).
    vmkfstools -c 1G -a lsilogic ./new_disk.vmdk
  • This will create two files.  new_disk.vmdk and new_disk-flat.vmdk.
  • Delete the file new_disk-flat.vmdk.
  • Open the new_disk.vmdk in Vi editor and replace the disk name with “Mydisk-flat.vmdk” in the line below #Extent description.
  • Next find out actual size of the Mydisk-flat.vmdk and divide the number with 512.
  • e.g the Mydisk-flat.vmdk is of 80GB, then the actual size in bytes will be 85899345920. After dividing it with 512 the value will be 167772160.
  • Enter this value in the extent description. Thus the extent description will look like.# Extent description
    RW 167772160 VMFS “Mydisk-flat.vmdk”
  • Save the file with name “Mydisk.vmdk”.

Attaching this disk will be easy task then.

Share

Leave a Reply