Creating a never booted OS X template in vSphere 5.1 - Part 6 - Converting the Sparseimage to VMDK format

The next thing is to convert our Sparseimage to VMDK format. For during this I will be using to Command Line utilities that are installed as part of VMware Fusion.

I would like to thank, a former colleague of mine, Alan Gordon, who is Chief Technology Officer at Humac Group for writing a article at Krypted.com on how to do this .

First off, open ‘Disk Utility’, located at ‘/Applications/Utilities/’, and select the volume called ‘ServerHD’ from the list of disks, as shown in the screenshot below.

26-Disk-Utility-Unmount.png

Now click the button named ‘Unmount’ in the top of the window.

The text ‘ServerHD’ in the list of disks, should now be dimmed slightly.

While the volume ‘ServerHD’ is still selected, click the button named ‘Info’ in the top of the window. This will bring up a information window, containing detailed information about the volume ‘ServerHD’.

27-Disk-Utility-Info.png

In this case we are interested in the information called ‘Disk Identifier’. In my case this is ‘disk2s2′, note down the disk number, in my case ‘disk2′.

Now close the ‘Disk Utility’ application.

Open up ‘Terminal’ located in ‘/Applications/Utilities/’.

Run the following command:

cd /Applications/VMware\ Fusion.app/Contents/Library/

Using the Command Line utility called ‘vmware-rawdiskCreator’, I will create a VMDK, which actually links to the Sparseimage, using the below command.

Please adjust the command with the disk number (‘disk2′), noted down earlier, and with a output path and file name of your choice (‘/Users/mads/Desktop/OS-X-Template-link’).

./vmware-rawdiskCreator create /dev/disk2 fullDevice /Users/mads/Desktop/OS-X-Template-link lsilogic

In my case I now have a VMDK file on my Desktop called ‘OS-X-Template-link.vmdk’. But this is in fact a empty VMDK file, linking to the Sparseimage.

Using the Command Line utility called ‘vmware-vdiskmanager’, I will now convert the VMDK-link file to a actual VMDK file containing the contents of the Sparseimage.

Run the below command, and as before change the input file (‘/Users/mads/Desktop/OS-X-Template-link.vmdk’) and output file (‘/Users/mads/Desktop/OS-X-Template.vmdk’), with the files of your choice.

./vmware-vdiskmanager -r /Users/mads/Desktop/OS-X-Template-link.vmdk -t 4 /Users/mads/Desktop/OS-X-Template.vmdk

The ‘4’ option in the above command, specifies that the output file should be in the format ‘preallocated ESX-type virtual disk’, which will generate a preallocated VMDK usable on ESX and ESXi hypervisiors. In my case this will amount to a 30GB VMDK file on my Desktop.

This command takes quite some time to finish, but it displays progress information along the way.

When it is finished, you can delete the Link file (‘/Users/mads/Desktop/OS-X-Template-link.vmdk’), because it is not needed any more.

Also you can open up ‘Disk Utility’ located in ‘/Applications/Utilities/’ and eject the Sparseimage file ‘ServerHD.sparseimage’

I now have two VMDK files on the Desktop:

OS-X-Template.vmdk OS-X-Template-flat.vmdk

The ‘OS-X-Template.vmdk’ is a descriptive file, containing information about the actual storage VMDK file, called ‘OS-X-Template-flat.vmdk’. They are both relevant, as they together form the VMDK disk I will be uploading to the Datastore in vCenter.

This series of blog posts consists of the following:

Tags: ESXi · Mac OS X · VMware · vCenter · vSphere