If you’re responsible for the configuration of tens, if not hundreds, of brand-new Macs then you’ll probably know how time consuming it can be to get them all set up exactly the same. The process of setting up a user account, installing any required software and applying all of the available updates on each and every Mac before handing them to users can be both laborious and horribly inefficient.
The resulting disk image will be saved as the familiar.dmg format, which has a number of potential uses ranging from creating a drive clone for backup purposes, restoring the image elsewhere as a bootable backup, or even for deploying the same Mac OS X installation on multiple machines. What if the DMG File Itself is Deleted or Lost? A DMG file is a file, so it can get deleted or turn corrupt. You can recover an Apple disk image file using Time Machine if you have a backup of your Mac. Or else, use the above data recovery software to recover even your deleted apple disk image file on your Mac.
For example, my ZFS NAS has a tiny virtual machine running Linux that simulates the Apple Time Capsule. When I create a backup using the Apple Time Capsule it creates a DMG sparse image for each Mac. Uses of Disk Images Software Distribution. A disk image is often used to download software on the Internet. Mac users have probably downloaded many DMG files that are mounted as virtual drives on your desktop. When used in this manner they are a reminder of a time when floppy disks ruled the software distribution world.
While we have covered disk imaging previously in the multi-part guide Disk Management From the Command-Line, we’ll now explore how to quickly and easily build a complete OS X image that includes everything we might need, including a pre-configured administrator account, providing us with a standardised image that can be restored to any Mac.
The Rollout Process
Let’s say we’ve just had a delivery of 20 new Mac Pros, all needing certain software and printer drivers installed, along with any OS X software updates applied. Many Mac technicians, even today, would simply set each one up, one at a time, until they were all finished. Although that would work, an incredible amount of time will have been wasted since the process for one is no different than the process for the other 19.
A popular method of performing the above task more efficiently is by setting up Mac Pro to completion, then creating a disk image of it through the use of a Triage Drive. Once this disk image has been obtained, it can be restored to the remaining 19 through services like NetRestore or even just copying the image to a triage drive, which the Mac is then booted from before restoring it via Disk Utility.
While this process is far better than setting each Mac up individually, the image that had been created has been booted, so any tasks like Setup Assistant will not run again. More importantly, certain preferences and settings will have been created using the original Mac’s Hardware UUID, which is unique to each Mac. Ideally, we don’t want this otherwise we could be potentially introducing issues and problems to a user’s system.
AutoDMG
Created by Per Olofsson, AutoDMG is a free utility designed to create never-booted OS X disk images.
Instead of requiring a dedicated Mac to build an initial image from, AutoDMG builds the image itself (based upon a suitable OS X Installer from the Mac App Store) and creates a restore-ready disk image that can be deployed in any number of ways.
Apps and packages can be included with the build which are then installed into the image and any available software updates are applied, ensuring a complete installation with no additional interaction once restored.
As the disk image has never been booted, there are no UUID mismatches and the Setup Assistant will even still run, providing the end-user with that “new Mac” experience.
Creating an Image
After downloading AutoDMG, launch the app to start creating a new build and then drag either an OS X Lion, Mountain Lion or Mavericks installer that has been have downloaded from the Mac App Store.
As soon as an OS X installer has been selected, AutoDMG will check for any available software updates that might need to be applied. This can save both time and network traffic since you can ensure the image you create is fully up to date before rolling it out, ensuring the latest security and software updates are put in place.
You can then download the updates by clicking Download or you can skip updates entirely by unchecking Apply updates.
At this point, you could simply click Build and AutoDMG would create a never-booted OS X installation that can be rolled out across any Macs it maybe needed on. Instead, let’s explore how software and drivers can be included within the image, reducing the need for additional configuration.
Installing Apps and Packages
Time Machine From Dmg Images
What makes AutoDMG so great for Mac admins is that you can install software or bundle apps with the image so if you want to include Dropbox or any required printer drivers in the image, you can. This is especially useful for printer drivers that Apple may provide as they tend to be a one-size-fits-all, meaning their file size is usually hundreds of megabytes to cater for a wide number of printers from each manufacturer.
Apple provides their optional software packages and printer drivers via the Apple Support site. The Epson Printer Drivers for OS X package is over 1GB so it makes much more sense to just download it once and include it within the image rather than having each Mac download the drivers separately.
To include standalone apps or have software packages installed during the image build, simply drag them to the Additional software pane.
Benefits of a Local Administrator Account
Having a separate administrator account on any Mac you support is extremely useful as you can install any additional patches or software updates without needing to include the user during troubleshooting. If you’ve ever had to wait before completing an installation just because you need the user to enter their password, you’ll know exactly what I mean.
CreateUserPkg is another software tool from Per Olofsson that will create a package which, when installed, automatically configures a user account. It can be used separately, via Apple Remote Desktop or, in this case, with AutoDMG.
By deploying the package during the creation of an OS X image with AutoDMG, any Mac we restore our prebuilt image to will have an appropriate OS X administrator account.
Creating a Package with CreateUserPkg
After downloading CreateUserPkg, launch the app and enter the account information you wish to use, such as the account’s name and password. An account picture can also be specified, along with the privileges of the account.
The options for User ID, Home Directory and UUID can all be skipped for the purpose of this guide and should only be altered if you know there’s a need to.
Also, change the package ID to better represent its use. The simplest change to make is to replace “example” with your (or company) name.
Once you’re happy with the settings, click Save Package and specify a filename and location.
Finally, after the package has been saved, it can then be added to AutoDMG and it will be installed, along with any other packages, as a new image is built.
After including any appropriate apps or packages to install, click Build. AutoDMG will prompt you to specify a name for the image file and a location to save it to.
Restoring an Image
It can take some time for AutoDMG to create an image but, once finished, a never-booted asr
compatible disk image is created that can be restored using any number of methods.
To test, I’d recommend using an external hard drive to restore the image to and then booting a suitable Mac from it. This will ensure you can test your image without nuking a Mac needlessly.
Launch Disk Utility and drag the newly-created disk image into the sidebar. Select it, then click the Restore tab and drag the partition you’d like to image to the Destination. To restore the image, Restore.
Once the process is completed, boot up the Mac from the external hard drive and you should then be greeted by the OS X Setup Assistant. After completing it, you’ll find any apps or software packages specified will have been installed. In the case of this guide, the Applications folder will contain a copy of Dropbox and all Epson printer drivers are preinstalled for use.
A note on Future Compatibility
During the development of an updated Mac, or a new model entirely, Apple’s hardware team have to fork whatever version of OS X is available to them and adapt it to include updated chipset drivers and kernel extensions for the latest hardware they’re working with.
Time Machine From Dmg Image
This means that, for a short time, the version of OS X that an updated Mac ships with will be different than the one available through the Mac App Store. If you were to try and restore an updated Mac with an image you had previously created, it will likely fail to boot since it wouldn’t contain the brand-new drivers or kernel extensions that only this modified version of OS X that the Mac ships has.
Only with the next update to OS X, usually a point release (that is, 10.9.x), are the two versions of OS X (the retail one, available on the Mac App Store, and the modified one that the new Mac uses) “merged” back together into one unified version. Until then, it’s best to avoid any new hardware purchases until the next incremental update to OS X if at all possible.
Wrapping Up
Once you’re happy with the image, you could then restore it to any Mac that need imaging quickly and easily using an OS X triage drive that contains a copy of the image, booting it from a suitable OS X environment and repeating the restore process above. Alternatively, you could look at options such as DeployStudio or OS X Server for more advanced imaging options.
Time Machine From Dmg Imagery
We’ll revisit image building in a future guide and explore how to customise it further, deploying more advanced functionality and enabling some built-in options that are disabled by default.