In the PC World, there many cool migration tools to convert a live, physical and running Windows machine into a VM (Virtual Machine) guests. I have migrated quite a few using VMware's own migration tool and they work great. Converting Linux and OSX isn't so easy.
OSX makes it much more difficult but it is not impossible. I plan to convert some Apple Xserves into VMs and consolidate them into a few running ESXi 5. That will be a later post as I am getting my feet wet; figuring this out and sharing it to those interested.
This tutorial will use VMware Fusion 5. You will need Fusion 5. It doesn't cost much and apparently the licensing allows you to install on 3 macs which is way cool.
I have switched completely over to VMware Fusion 5 from Parallells and VirtualBox on the Mac platform. It makes it easier to convert a VMware machine build into something I can import into ESXi. The difference between Parallels, I won't go into here but so far, I am digging Fusion. I really like the fast suspend.
To Clone a Physical Mac there are a few things you need to consider.
1)Is it legal?
Well, Servers from 10.5 can be virtualized. Workstation/Desktop (non-server) OSX 10.7 and 10.8 can be virtualized. For my use case, yes, I am completely legal. I am converting a 10.6.2 Snow Leopard server. I'll even try as far back as 10.5 if any of those still exists in my inventory. There are back-door step (changing a plist file) to virtualize 10.5 and 10.6 non-server but I won't go there.
2) You need to build a base OS build from scratch to act as your Cloning "middleman." This should be a minimal Mac OS X VM guest build just big enough to run something like Carbon Cloner
3) You should have a spare USB drive or network share to store your "cloned disk images."
How To Convert a Physical Macintosh into a VMware VM Virtual Machine.
It is a multi-step process so I will outline how I successfully converted a few Macs.
Step 1. Clone your Physical machine using your cloning tool of choice. CarbonCloner is the most popular. Clone it to a Sparse Disk Image. It makes it easier to transport and store multiple clones. Do not try to clone to a drive and use it as your source. It will probably be a waste of disk storage and you wont be able to boot from it in your VM. Stick to creating DMG images you can clone to. I won't go into details how you do this but there are probably hundreds of tutorials on cloning your mac on the internet. If you are a mac IT pro reading this post, it is most likely you've already done this.
Step 2. Build your "middleman" OSX build. Here, you have to actually install a full running OSX that runs inside Fusion 5. Trust me, it is pretty easy unlike various hack attempts in the past. No pseudo hackintosh in a VM or special CD-ROM iso boot disk. It is a straight install as if you are installing on to a real Mac.
I chose something simple. I did a quick install of 10.7. You can even install from a DMG. I believe I used the ESDInstall extracted from the app store download. The whole process took 20 minutes on my setup and the size was around 12 GB for a virgin system. I simply stored my build on an external drive that I can shuttle around.
OK. We've gotten this far. At this point. I would strongly suggest backing up your middleman OSX so you can re-use again if you want to clone more physical Macs. You will end up discarding the middleman's drive when you are finished.
Step 3. Add additional Virtual Hard Disk(s) to your "middleman" OSX build. In my example, I added two more just for the sake of experimentation.
Step 4. Boot into your middleman OSX, format your additional virtual drives and prep them for destination clone. Remember to format them GUID.
Step 5. You should have your sparse disk image from Step 1 from somewhere accessible by the middleman OSX. You can copy from the network or from a share if your guest's OS drive is big enough.
I much prefer using a USB drive with all my builds. Simple. Just plug in an external USB drive and allow Fusion to take ownership. USB 3 is supported on Macs that have USB 3. The VM will see the USB mounted mac drive as a mounted external drive just as your normal hosts sees it.
Step 6. The Clone process. If you've gotten this far, you are 90% done. Run Carbon Cloner or whatever cloning tool you have to clone your sparse image to your second or third newly added virtual drive. Let the clone process run the usual course as you would clone a real mac.
As you can see in the screenshot,I am cloning from my sparse disk image.
Step 7. When finished, shut down.
If you think you can reboot into the next step, you will be in for a big surprise. This is the error message I got from trying to boot a 10.6.2 server from a 10.7 middleman install. Unfortunately, there are probably boot flags and indentifiers that restrict what can run/boot on what OS.
You might be safe and and skip to Step 9 of you are cloning from the same build as your middelman OSX. For example, cloning from a real physical 10.7 Mac if you were using my example.
Step 8. Now, this is the most important step I had to figure out. Change your Virtual Machine's device setting. It is not easy to find and not so obvious. Click on the "General" under the System settings.
And this the part that is not so obvious. The Name and OS look like normal labels.
But they are actually clickable input fields. This is my pet peeve. It shows a lack of UI (User Interface) understanding in the most fundamental way in regards to how applications should be designed. The gist of this section is, you have to change the OS device label to the updates guest should be running. My original build was 10.7 and now, I had to now change it to 10.6 so I can boot into a 10.6 build.
To boot back to my middleman OSX, I would have to go back and change the OS device label back to 10.7
And that is pretty much it.
Step 9. Select your new Virtual Hard disk as the new boot drive under "Startup Disk" from the main Settings. Reboot and test your new guest VM.
And Voila! An older 10.6 Xserve build running inside Fusion on my Macbook.
At this point, you should just delete the original drive containing the bootable "middleman" OSX. You can remove it from your inventory from the settings. Now, you should have a full running clone of your existing physical mac. You may want to install VMware guest tools but for me, I will wait till I have my builds migrated over to ESXi.
So far I have a few Macs virtualized and I will undergo some testing before I embark on building out an ESXi 5 build on a physical 12 core XServe which will host these new Mac guests.
There you have. Hopefully this will help some people looking to virtualize their macs.
Extra Credit for Mac IT guys:
And a little extra tidbit of info. If you are looking to doing this as a failover precaution due to the fact Xserves are no longer being sold, you can do scheduled nightly clones from a live running real mac. In essence,have a VM guest that is continually synchronizing with a live mac in the event the live mac fails and the VM guest can take over.
This is my style of ghetto IT that works:
You would need to set up two Carbon Copy schedulers. One on your live Mac and one on your middleman VM mac.
Either your live mac or VM Mac would need to share out a volume or have both access a shared network storage. The Live Mac would backup nightly to a sparse image on the shared network volume. Then schedule the middleman mac to clone from that nightly backup to your new VM second drive. You would need to schedule them apart to let the live mac to finish it's clone. Usually it should be quick because Carbon Cloner doesn't do a full clone on subsequent clones. It only copies the incremental. You can also use SuperDuper, Chronosync or old fashion rsync. With rsync, you just need to add the -E flag to copy extended attributes. I would personally run a cron job with rsync every hour to get at least an hour of synchronized data.
So in the event your Xserve (or other Mac server) physically dies, you should have a fairly up-to-date VM guest ready to be fired up and run while you go ebaying for a replacement Xserve or buy a new Mac Pro.