Creating a never booted OS X template in vSphere 5.1 - Part 1 - Introduction and reason for doing this

The goal of this series of blog posts is to produce a never booted installation of OS X Mountain Lion, in a VMDK, which can be used as a template in VMware vSphere vCenter 5.1.

The reason for doing this, is that when a OS X installation is done the normal way, using the Installation GUI, then on the first boot of the newly installed machine there is created a bunch of machine specific files and items.

These machine specific files and items, e.g. the Local Kerberos Key Distribution Center (or LKDC), needs to be cleaned out, if the installation is going to be used as a template, either in VMware vSphere or using traditional image deployment techniques.

Instead of doing the installation using the normal GUI procedures, it is possible to install OS X into an empty DMG image file, and therefor the installed version of OS X is never booted, and thereby the machine specific files and items are never created. Leaving you with a pristine and untouched version of OS X, ready to be booted for the very first time, when deployed.

During this series of blog posts I will walk you through how to do all this, with detailed instructions and screenshots.

I will be using the following tools and files throughout this series of blog posts:

System Image Creator

This is a BASH script, for installing and configuring a never booted version of OS X into a DMG image file.

It is a free Open Source tool, originally created by Duncan McCracken, at Mondada.com.au

The newest version of the BASH script is available on Github: https://github.com/mondada/SIC

Disk Utility

This is a built in GUI application, ‘Disk Utility.app’, located in ‘/Applications/Utilities/’. It is used for managing hard drives and disk images.

installer

This is a built-in Command Line tool in OS X, which is the CLI equivalent of the GUI ‘Installer.app’. But the CLI version lets you specify the target disk to be install into. In this series of blog posts it will be a mounted Sparseimage file that will be the target.

VMware Fusion

This is VMware’s desktop hypervisor for Mac.

I am not going to be using it in the normal way.

Instead I am going to use some Command Line Utilities included with VMware Fusion. More precisely vmware-rawdiskCreator and vmware-vdiskmanager.

It does not have to be a purchased version of VMware Fusion, a Trial version will work fine in this case.

Obtain VMware Fusion here: http://www.vmware.com/products/fusion/overview.html

VMware Tools for OS X from a ESXi host

VMware Tools for OS X will be install via the Command Line into the never booted version of OS X.

Install OS X Mountain Lion.app

The newest version of “Install OS X Mountain Lion.app”, by buying and downloading “OS X Mountain Lion” from the App Store.

Link to Mac OS X: https://www.apple.com/macos/

Once downloaded, don’t actual run the installer.

Instead, go into your Applications folder, ‘/Applications’, and locate the app called: ‘Install OS X Mountain Lion’.

Right-click (or CTRL+click) on it, and chose ‘Show Packages Contents’, which will open a new Finder window, revealing the contents of the app.

In this new Finder window, navigate to the following folder:

Contents -> Shared Support

In here is a file called InstallESD.dmg.

This ‘InstallESD.dmg’ file is a “Virtual DVD” for installing Mountain Lion onto either a physical or virtual Mac.

This series of blog posts consists of the following:

Tags: ESXi · Mac OS X · VMware · vCenter · vSphere
Archived Comments:
Frank MullerPosted on July 19, 2013

Maybe a stupid question, but this will only work when you are using Apple Hardware to run vCenter right?

Or does this work on vCenter under Non-apple hardware?

Interesting write-up by the way :-)

Mads Fog AlbrechtslundPosted on July 19, 2013

Yes, that is completely correct.

According to the Apple EULA, OS X is only allowed on Apple-branded Hardware.

VMware (and Apple) have made a hardware-check in ESXi, which identifies when ESXi is running on Apple-branded Hardware, and thereby allowing the start/running of OS X guest.

You can mix "PC" hardware and Apple hardware in a cluster, but you can't migrate a OS X guest to a non Apple-branded piece of hardware in the cluster.

The Apple-branded Hardware on the other hand, can run all the guest OSes, that the "PC" hardware can run.

Jason BushPosted on July 19, 2013

Thank you for this writeup. I'm getting an error

Unable to create the source raw disk: The specified is not a valid physical disk device.

when I run

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

Any ideas what the cause would be?

Mads Fog AlbrechtslundPosted on July 19, 2013

Hi Jason

If that is the command, you are trying to run, then you need to modify it to your own computer setup.

This works on my computer, because my account is called 'mads' and because the Sparseimage Disk Number is 'disk2'.

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

If your account is named 'jason' and the Sparseimage Disk Number on your computer is like 'disk3', then the command should look like this:

./vmware-rawdiskCreator create /dev/disk3 fullDevice /Users/jason/Desktop/OS-X-Template-link lsilogic

Hope that helps you to get it to work.

Don MontalvoPosted on July 22, 2013

Great article!

Nico Van der MeirschPosted on July 30, 2013

Nice to read that we aren't the only ones, which running a VMWare environment on Mac.  Still two behaviours/issues we discover in our current "VMware ESXi, 5.1.0, 1117900" setup, are following items:

  • vmwaretools stop running on moment of user logout
  • extending of a VM Hard disk can't be fulfilled on Mac OS level

Don't know if this issues are local to our setup, or if you see familiar behaviour at your site?

Mads Fog AlbrechtslundPosted on July 30, 2013

Hi Nico

I haven't noticed any problems with vmwaretools on user logout, but then again must of my OS X VM's don't get logged out.

I have also have trouble extending a HFS+ partition on a VMDK, inside a OS X VM.
Both a boot-partition and a simple data partition.
I haven't found a way to do it, yet.

DavePosted on August 21, 2014

Dave

Mads Fog AlbrechtslundPosted on July 24, 2013

Hi Oli

DavePosted on August 21, 2014

Dave

Mads Fog AlbrechtslundPosted on July 24, 2013

Hi Oli

TomPosted on August 21, 2014

Tom

Mads Fog AlbrechtslundPosted on July 24, 2013

Hi Oli

John LockwoodPosted on August 21, 2014

John Lockwood

Mads Fog AlbrechtslundPosted on July 24, 2013

Hi Oli

PavelPosted on August 21, 2014

Pavel

Mads Fog AlbrechtslundPosted on July 24, 2013

Hi Oli