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
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.