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.
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.
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’.
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:
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’).
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.
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:
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:
- Part 1 – Introduction and reason for doing this
- Part 2 – Creating an never booted DMG using System Image Creator
- Part 3 – Applying a configuration and exporting a Master, using System Image Creator
- Part 4 – Clone the DMG to a Sparseimage file using Disk Utility.app and then install VMware Tools
- Part 5 – Obtain VMware Tools from ESXi host and install into the Sparseimage
- Part 6 – Converting the Sparseimage to VMDK format
- Part 7 – Making the template in vCenter 5.1 using the never booted VMDK