Dual-Boot Imaging for Mac OS X Lion and Windows 7

Posted on

One of the benefits of having a new Mac lab is setting it up for all the classes we teach.  Of course, most of them are taught on PC software, meaning I need to have a dual-boot image with Windows booting as the default OS.  Not a problem really with a Macintosh computer, though it takes a little bit of tweaking to get it working right as I found out. I started out by planning how the images would need to be built.  The Mac image was not a problem, as it was pretty much the same image that I've been using for years (just upgraded to Lion).  The Windows image took some doing and quite a lot of googling as I don't often install Windows, let alone create images.  But that was the easy bit.  The hard part was looking for an image process that would work for free.There are quite a few Windows image tools out there that are free and work on a PC hard drive (i.e., MBR partitions).  For our PC labs we have used Acronis because of it's simplicity and ease of use.  And it works great for the PC installations, but as the Macintosh uses a GUID partition table instead of the Master Boot Record Acronis isn't able to see it and therefore cannot perform a restore.  So I needed another tool. Winclone is perhaps the best known friend of the dual-boot image community, as it makes a cloned image of the existing Windows partition on a Mac and does the restore.  It would be a no-brainer to use Winclone, but for one issue:  Two Canoes no longer develops Winclone, and the last official version (2.2) barely worked on Snow Leopard and will not work on Lion.  Fortunately a hacked version has been released, 2.3, and it will work on Lion with some preference changes.  When you install Winclone, do so on a Mac partition that you intend to use as a NetRestore image.  Why?  Well, it makes it easier to deploy your Winclone image once you are done (install once, image, and deploy to multiple computers as you go along).  It also works better in a NetRestore image rather than a NetBoot image because of the amount of data that needs to be cached and transfered during the image.  I have tried both, and find the NetRestore to have far superior restore performance on a single Mac than the NetBoot image.  Once installed, open Winclone and in the Winclone menu select Preferences.  Once there, click on all options to deselect them, and select the compressed image (as opposed to the dmg image).  The Winclone image process will not work without this step (as the logs will show). Then start your image process.  I saved it to the Desktop for convenience, but as long as you know where to expect the image to be, any place is fine.  After a while (30 minutes to several hours depending on the size of your Windows install), you should be ready to deploy.  You may get an error telling you it wasn't able to complete correctly after running through the whole process, but the restore has seemed to work for me so I have ignored this error.  Once finished with Winclone, you now need to make your deployment image.  You can use something like DeployStudio if you have it, but I've always been happy with the NetBoot service for Mac OS X Server.  Granted, DeployStudio is great for large deployments because of it's multicast method of restoration, but with a small lab of 16 computers, NetBoot works just fine (and doesn't take a lot of configuration or port management).  If you are going to use NetBoot, you will need to use the System Image Utility as part of the 10.7 Server Admin Tools.  You don't have to host the new image on a Lion Server, but you need the Lion version of Server Admin Tools to create a Lion NetRestore image.  I also like making an autoinstall image using the Custom NetRestore Automator tools that System Image Utility provides.  At any rate, build your image and upload it to your NetBoot server.  In addition to the image with Winclone, I also have a NetInstall image for Lion, so I can partition.Now I start by booting to the Lion NetInstall image and partitioning the computers.  I have 4 partitions, but really you only need 2:  One for the Mac, and one for Windows.  For the Windows partition, I used exFAT, though I suppose you could use FAT-32 if you needed.  In the end it doesn't matter, because Winclone will replace it with an NTFS partition, so it's all good.  Once the partition is complete, I restart to my NetRestore image, and let it run.  For my configurations, it took a good 3 hours for all 16 computers to image, but the time will vary based on what you have installed on both the Mac side and in your Windows image. Once finished, I started Winclone and restored to the Windows partition.  This took another hour per computer, but then it's running locally and not on the network, so that makes sense.  Once finished, I downloaded rEFIt and installed it for managing the boot process.  Technically I could do this with the built in EFI booter, but I like the flexibility that rEFIt gives me.  Once finished, I needed to configure it.  This is all done in the refit.conf file (located at /efi/refit/refit.conf).  I just opened the file in vi and edited the timeout from 20 to 5 seconds, and set the default image to Windows.  Once done, I save, and run the enable script (/efi/refit/enable.sh), authenticate for sudo, and it's done!  Now I just needed to reboot..And the install is broken.  It seems the virtual MBR that EFI keeps didn't get updated with the Winclone image.  There are two ways around this:  either I do a fresh install of Windows and then restore the Winclone image, or I can boot off a Windows Recovery CD (or install DVD) and repair the MBR to get it to work.  That takes significantly less time, and once done I shouldn't need to worry about doing it again.  So I ran the repair and it worked!  Everything booted up correctly, the image was done.  In total it took me a full day of imaging for a lab of 16.  Add on to that a full day of tearing down the old lab and placing the new lab, it's been a fun week so far.  The good news is that now the hard part is over, and I just need to bind the new computers to the Directory, and all will be running smoothly. Though in future, I may think of other ways to run a deployment, either by running a dd backup and restore, or using the Windows Backup tech to deploy the Windows image.  It shouldn't be that difficult this next time around, because the initial work is all done.  I'll keep you posted on the process as I get it worked out.