DMG/VMDK OS X install media for OS X guest

Discussions about using Mac OS X guests (on Apple hardware) in VirtualBox.

DMG/VMDK OS X install media for OS X guest

Postby thomaslc » 15. Jun 2017, 17:18


Create a writeable DMG image, use OS X install app's 'createinstallmedia' utility to write to DMG, then use VBox's 'vboxmanage' to enable 'raw hard disk access' to DMG


VBox host: iMac (21.5-inch, Mid 2011), 2.8GHz Intel Core i7, 32GB RAM; Install OS X El Capitan (version 1.7.50)
VBox: version 5.1.22


Note: I have access to an "Admin" account, i.e. "Allow user to administer this computer" is enabled; haven't played around with adding my "Standard" account to other groups. Also, these instructions are based on my system with one internal hard drive and no external devices attached; with other storage devices connected the "/dev/diskX" identifier you need to use in the commands below may be different than in my case.

1. Log in to a "Standard" OS X account and start Disk Utility; select "File | New Image | Blank Image..." and edit the options, e.g.

Save As: install-elcap
Name: install-elcap
Size: 8 GB
Format: Mac OS Extended (Journaled)
Encryption: none
Partitions: Single partition - GUID Partition Map
Image Format: read/write disk image

this should create a DMG that will be mounted as "/Volumes/install-elcap". You can change the names used in "Save As:" and "Name:" as desired but you'll need to modify the directions below to reflect those changes.

2. open Terminal and "su - <"Admin" user>; next, I ran "sudo -i" to become root and then executed
Code: Select all   Expand viewCollapse view
"/Applications/Install OS X El" --volume /Volumes/install-elcap --applicationpath "/Applications/Install OS X El"

Once "createinstallmedia" completes, run "exit" to log out as root; run "exit" again to log out as your "Admin" user

3. run "mount" to determine the device "Install OS X El Capitan" is assigned, e.g. "/dev/disk1s2 on /Volumes/Install OS X El Capitan" the device being "/dev/disk1"

4. run "diskutil unmountDisk /dev/disk1" (step 5 won't work if disk partitions are mounted, see the VBox manual, section " Access to entire physical hard disk" which states "Note that on OS X you can only get access to an entire disk if no volume is mounted from it.")

5. run "vboxmanage internalcommands createrawvmdk -filename /Users/<"Standard" username>/install-elcap.vmdk -rawdisk /dev/disk1"

6. step "5." causes the DMG to remount so re-run "diskutil unmountDisk /dev/disk1" otherwise you'll get an error in step 7. when you try to add the .vmdk

7. start VirtualBox, create an OS X El Capitan vm, add the .vmdk (e.g. /Users/<"Standard" username>/install-elcap.vmdk) to the vm's SATA controller on the "Storage" tab

Sorry for the brevity, hope I've accurately transcribed my notes. I'm guessing someone with more scripting ability than I could make this easier.

Posts: 1
Joined: 14. Jun 2017, 22:38

Return to Mac OS X Guests

Who is online

Users browsing this forum: No registered users and 4 guests