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.
This is seriously ridiculous...but ridiculously useful. Thank you for figuring this out and posting, it saved me hours of work figuring it out myself.
ReplyDeleteThank you for posting this. As the previous comment says, this is ridiculously useful! I had actually been looking for a way to accomplish this. Thank you!
ReplyDeleteFantastic! I've been looking for this solution for a long time! Thank you!!
ReplyDeleteHi,
ReplyDeleteThanks for a good guide! When I tried my migrating my 10.6.8 Server today I ran into a problem that you might recognize. All users in my OD are lost and thus I am not able to log into email anymore for instance. Do you have any idea what can be done about that? Maybe it is a common migration error that I am unaware of.
Yes, that could be a problem with OD if you did a hot clone (clone while the machine is running). The OD database doesn't like to be touched/copied while it is running. You should turn off the service if you are doing a hot clone. The best way is to d a cold clone.
DeleteFor cold cloning, You may have to do a target disk and clone with another machine, boot off another boot disk and clone that way, or take the drive out and clone on another machine.
For OpenDirectory, there are also a bunch of scripts online I've seen (afp548) that backs up the OD database and allows restore on another machine. Basically, you have to disable the service so it is running, export the user/password database, restart back the service.
You may want to try to do a backup/restore of the OD before trying to do another clone.
Figured as much, I have read up a bit today and the cold clone seems to be the best way. I will try to find time to do a cold/Target clone when I get back home for next weekend. It would be really nice to finally retire my 2006 Mac Mini from it´s mail service duty, I am anticipating it crashing any day now... ;)
DeleteGreat tutorial! Thanks for posting this, it's exactly what I was looking for. That label being clickable completely eluded me until I read your article... I've seen that "CPU has been disabled" message and figured that was just the end of the line... I've spent several hours trying figure out how to set the CPU id mask in the .vmx file, etc... thank you so much! In my particular circumstance I'm going to (just for fun) see if I can virtualize a Mac mini that we've been using to run DeployStudio... :) Curious, did you ever get any of your Mac VMs running on ESXi 5? PS: Really love the Extra Credit for I/T Guys tip, great idea, thanks!
ReplyDeleteGreat article, thanks for posting! Exactly what I was looking for, and written exactly at the level I need! Just for fun, I'm going to see if I can clone the Mac mini we've been using at work for Deploy Studio into a VM :) On a different not, curious, did you ever get any Mac VMs running on ESXi?
ReplyDeleteI have about 12 or so macs run in ESXi.
DeleteWhy not just backup your physical Mac using Time Machine, then boot with a recovery USB (use the free Apple tool to create it), and restore from the Time Machine backup? I've done this and it works really well with Fusion 6. Moving a Fusion VM to an ESXi 5.5 server (assuming you're running it on an Apple platform like a MacMini, etc.) is also simple using the Standalone Converter from VMware.
ReplyDeleteI don't think there is a Standalone converter for Mac from Vmware. As for time machine, RSYNC/Carbon Cloner is much, much faster.
DeleteHi there, this post is great and solved a major issue of mine in virtualizing my Mac. I strictly followed your instructions and everything seems to work fluently, even if when running Mavericks on fusion 6 my CPU still gets hot, same as it does in Parallels.
ReplyDeleteI have a last question for you: when you open sys preferencies in VM there is no way to change the trackpad setttings (no trackpad detected). Is there a troubleshooting for this?
I appreciate your job, thanks.
Thank you for sharing valuable information. Nice post. I enjoyed reading this post. The whole blog is very nice found some good stuff and good information here Thanks..Also visit my page. Pro-Ma Systems Shop powered by PrestaShop.
ReplyDeleteLoved your post. So much so, I attempted to virtualize a Mavericks Server into Fusion Pro 7.0.1 but hit two major roadblocks (perhaps connected). First, the host name got wiped out & reset to "localhost" in the VM. Is that expected? Second, the certificate I had installed seems to be causing all kinds of SSL problems for apache (Init: pass phrase incorrect, etc.). Any ideas what I could do differently such that the hostname, the Computer Name, and the certificate would survive virtualization? Thanks!!
ReplyDeleteAwesome blog........Thank u for sharing this initiative information.VMware Fusion is a software hypervisor developed by VMware for computers running OS X with Intel processors. Fusion allows Intel-based Macs to run operating systems such as Microsoft Windows, Linux, NetWare.imac Migration
ReplyDeleteThank you. Thank you! Thank you!!!!!!!!
ReplyDeleteGood solution for vhd recovery i will suggested, however it efficient in repairing corrupted and deleted vhd files .It supporst all windows platform and is capable of repairing both static and dynamic vhd files .
ReplyDeleteRead more:- http://www.filesrecoverytools.com/vhd-data-recovery.html
Thanks a lot for this info. I could never have guessed every step here. I got stuck on Step 5 when trying to access the sparse image via VMWare's shared folders. With CCC or Disk Utility or even trying to mount it in the Finder, I'd get "no mountable file system" errors or similar. Finally I found this info at the CCC page:
ReplyDeletehttp://bombich.com/kb/ccc4/backing-up-disk-image
That gave me the idea to connect from VMWare to my Mac using AFP on the LAN. When I did that, I was able to access the sparse image with CCC.
In the OS install, it's not entirely clear to me how you attach the DMG. I've attempted doing that and it simply doesn't work. I have DMG files and the ESD files from the installation *.app, which is what I need to install from. I suppose I could burn a CD if I needed to... or convert the DMG to ISO? How did you attach the installation image?
ReplyDeleteDude you rock! I just booted up my clone, and Mac is running inside my Mac!! Now I just have to get it into ESX
ReplyDeleteThanks so Much!!! Was trying to restore from time machine but was running into so many problems. Followed your steps now I am all set! KJE.
ReplyDeleteThank you for this tutorial. It is one of the best outlined methods I have seen in my quest to virtualize a Mac. Since you were staging this for ESXi I would think that it should work for running the VM in Workstation on a Windows machine.....I hope. Would this be correct?
ReplyDelete