miniclone for Mac OS X
utility script to create minimal bootable clone of active root
particularly useful for making bootable utility flash drives

table of contents


background

Mac OS X's installation media includes a number of very useful tools for resetting passwords, diagnosing hardware issues, cloning drives, copying data, checking and repairing filesystems, managing disks, and even conducting forensics if you're so inclined. However, there are a number of situations in which these tools just don't work or where a full Finder-and-Dock interactive environment is badly needed, notably when in-a-pinch access to opening files is needed, or when a whole-disk encryption (WDE) product is used to protect mobile data. In this last case in particular, a secondary bootable system drive is required with support for the underlying sector-level encryption. In general, though, it's really handy to be able to turn a USB drive or SD card into a bootable volume that'll boot up any Mac and be useful for fixing a wide range of issues.

The following page contains a script for creating a bootable clone of the currently running system on any target media, including thumb drives, flash drive, or other internal or external bootable media. Naturally, this is most useful with a keychain thumbdrive. It is the goal of this project to create a bootable, useful system on 16 GB of external storage that can open up Microsoft Office documents, open VMware virtual machines, and fix most disk issues.


usage

WARNING: MINICLONE WILL IMMEDIATELY ERASE THE CONTENTS OF THE VOLUME YOU AIM IT AT, AND IT WILL NOT CHECK IF THIS IS OKAY. USE AT YOUR OWN RISK.

miniclone is a shell script that either expects to find a volume called "miniclone" or expects to be provided the full path (for example, "/Volumes/miniclone") of a volume it can erase and replace with a minimal installation of Mac OS X from the active boot drive. ONCE AGAIN, MINICLONE WILL IMMEDIATELY ERASE THE CONTENTS OF THE VOLUME YOU AIM IT AT, AND IT WILL NOT CHECK IF THIS IS OKAY. USE AT YOUR OWN RISK.

It is worth noting that Windows XP's GUID support is incomplete at best, and does not totally support multiple partitions on a single drive. In situations where you want to use a multi-partition device, I recommend using an MBR partition table, and rEFIt (link below) to allow Mac OS X to boot off the MBR-partitioned device. Just installing rEFIt is enough; no need to configure it.

In order to run miniclone, either invoke it as root or just type: sudo miniclone /Volumes/target


Replace "target" with the volume name of an already formatted and mounted partition you want to use. miniclone will figure out its device file, wipe it clean with a new HFS+ partition, and start replacing it with a subset of the contents of your boot drive, as specified in the script. Using a text editor, it's very easy to modify miniclone to add or remove applications, directories, or services.

The script, as it's currently configured, will create a miniclone of about 15 gigabytes, if you have all the software I've got it configured to include. I've configured it as such because I personally want to be able to use VPNs, open Microsoft Office documents, boot up VMware virtual machines, and really be able to use the underlying system while extracting data from a broken hard disk or a system I'm performing forensics on, without altering that drive. The script is configured for my preferences, not for yours. I can't presume to guess what they are, and won't try. Once again, it's very easy to alter and if you want a more lightweight miniclone, please help yourself to vi, emacs, TextEdit.app, or your editor of choice, and remove the full line(s) referring to each program I've included that you don't want. While my miniclone isn't as mini as it could be, with a little elbow grease, you ought to be able to make a miniclone as small as four or five gigabytes if you want!

Please also note the small section of logic at the very end of the script that looks for my own personal home directory ... this is to allow simple per-user customizations and will not interfere with the running of the script if you don't have a user named "peter" on your system. Within that logic, it refers most notably to .plist files for loginwindow.app that remove all login items. These are not mandatory, but will speed up your login time tremendously. If you have allowed this little section of logic at the end to somehow interfere with your use of the script, I can only refer you to Shell Scripting 101. "Teach Yourself C Shell in 14 Days" is a really good read.


files

miniclone is licensed under the GPL with one caveat: if you change the directories and files cloned in the existing foreach statements, I consider this a configuration change and you don't need to send back your changes.


known issues


credits


links


contact info

this page compiled by
peter bartoli (
pgp key)
and last updated 6/20/2010