Deploying a Dual-boot Macintosh

* NetRestore retirement notice

NetRestore has been retired, so much of the content of this article is no longer current. As time permits, I will update this article to reflect new deployment tools for dual-boot Macs.

* It's a brave, new world

The introduction of Intel-based Macs brought some exciting new features to the Apple platform. Performance is perhaps one of the more obvious improvements; boot times of 18 seconds, code compiles twice as fast, faster drives, faster graphics, everything is just smokin'! I, of course, am particularly impressed with the performance of the new firmware. It's like driving a brand new sports car on a smooth, freshly paved road. To say that EFI is an improvement over Open Firmware is an understatement. Open Firmware was good, though, certainly better than BIOS. Booting from a "new" drive was entirely painless, and support for "touchless" deployment has been with the Mac for ages.

These performance enhancements, plus the greatest OS on earth, were apparently still not enough to woo the hearts of Windows users. Because Microsoft decided to pull EFI support for Windows Vista, it appeared for a while that it would be very difficult to boot Windows on Apple's new hardware. Alas, in April 2006 Apple announced Boot Camp, a utility that would allow you to run Windows natively on Apple hardware. Boot Camp is essentially the following: 1) a utility that allows you to dynamically and non-destructively allocate free space on your boot drive to a new partition. This new partition can be formatted however you like, Boot Camp formats it as MS-DOS. 2) A disk image of Windows drivers for Apple hardware. 3) "Legacy" BIOS support provided by an EFI compatibility module. To stick with my car analogy, that's like putting racing tires on a Yugo and driving on a newly paved road. While Windows will boot, it's still Windows when it's done booting.

Deploying Windows on a Mac is, in my opinion, easier that deploying it on any other hardware. The Leopard Installation DVD includes all the Windows XP/Vista drivers for all Intel-based Macs -- install this once and be done with any drivers issues related to all OEM hardware. Mac OS X and Mac OS X Server provide excellent deployment tools, and these tools can be leveraged to deploy Windows too. Read on to learn how you can mass deploy Windows and Mac OS X on the hottest hardware available.

* Divide and conquer -- Master machine setup

The first step to any mass deployment is configuring a "model" machine exactly the way you want each of your client machines to look. I will briefly describe the process of installing Mac OS X and Windows on the same machine, then go into more detail on image development. The instructions that follow assume the use of "NetRestore" (3.4 or later), which is a free and open source enterprise deployment utility for Mac OS X (similar to Ghost, but free).

  1. Install Mac OS X, configure as desired.

    If you already have a master image (for Intel-based Macs), restore that to your master machine's boot drive. You can use NetRestore to restore that disk image.

  2. Use the Boot Camp Setup Assistant to add a partition for Windows.

  3. Install Windows, choosing to format the partition as NTFS. Configure as desired.

    If you already have a Windows XP (SP2) installation (on an "ACPI Multiprocessor PC" type machine -- check in Device Manager > Computer) that you use for deployment, great! Get that installation onto a USB or Firewire drive (use your current cloning tool or simply pull a drive from one of your PCs) and attach that drive to your Intel-based Mac. Then use NetRestore to restore your Windows XP installation onto the internal partition. Reboot into Windows and install the Macintosh drivers for Windows.

    Additional tips:

    • For maximum portability, install all of the Macintosh hardware drivers from the Leopard Installation DVD per the "Sysprep Setup" instructions on Microsoft's How to Add OEM Plug and Play Drivers to Windows XP Kbase article.

    • Fix how Windows determines the system time from the hardware clock. With BootCamp 2.1 and later, this can be managed in the Boot Camp Control Panel on Windows. For earlier versions (only!), you need a DWORD key called HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control \TimeZoneInformation\RealTimeIsUniversal with a value of "1" in the Windows registry. See this insanelymac.com's forum post for more details.

    • If you intend to use BootPicker, remove the Logoff options to force users to reboot rather than logging out (reboot on logout would be nice, but Windows will not run the shutdown command in a logoff script). To do this, you can make two registry modifications or implement two Group Policies. The registry settings are:

      HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\ Explorer\StartMenuLogOff [DWORD, value = 1]
      HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\ Explorer\NoLogoff [DWORD, value = 1]


      The first setting removes it from the Start menu, the second removes it from the Shutdown Windows dialog box. You can also use gpedit.msc to affect these changes:

      User Configuration\Administrative Templates\Start Menu and Taskbar > Remove Logoff on the Start Menu
      User Configuration\Administrative Templates\System\Ctrl+Alt+Del Options > Remove logoff

  4. Use the Windows Disk Defragmenter tool to defragment any files on the Windows volume: Start Menu > Programs > Accessories > System Tools > Disk Defragmenter

  5. Reset the Startup Disk to the Mac OS X partition using the Start Menu > Settings > Control Panel > Startup Disk utility

  6. While booted into Windows, run Setup Manager, then SysPrep to prepare the volume for mass deployment. Have SysPrep reboot the machine when it is finished with its tasks.

* Create master images

To create your master images, you may be booted from your master installation or you may boot from a Mac OS X installation on a Firewire or USB hard drive. Before you begin, download NetRestore and read through the documentation. Specifically, I recommend reading the Deployment Process Overview and Setting up a NetInstall-NetRestore Deployment Solution sections to gain an understanding of how deployment works, in general, on Mac OS X.

  1. Launch the "NetRestore Helper" application in the NetRestore folder.
  2. In the "Create Master Image" tab, select the drive containing your master Mac OS X installation.
  3. Choose whether to create a read-only or read-only & compressed disk image. Compressed disk images are preferred for all but the slowest Macs (old G3s, etc.)
  4. Choose whether to skip file-level restore checksumming and multicast restore post-processing. In most cases, the defaults are fine.
  5. Click on the "Create Master Image" button and save the master disk image to an external drive or AFP file share.
  6. Repeat these steps for your Windows volume.

* Deployment

Now is a good time to review the Deployment Process Overview and Tips for Beginners sections of the NetRestore documentation. Here I will describe a simple, manual deployment method so you understand how the process works at a basic level. Once you're comfortable with the process, I encourage you to try other methods that offer more scalability.

A Manual Method

  1. Boot from external media (NetBoot or a Firewire or USB hard drive) running Mac OS X. That external boot drive should also contain copies of your master images and the NetRestore distribution.
  2. Use Disk Utility to partition the target disk (it's OK to format the Windows partition as MS-DOS or FAT or even HFS+, when you retore an NTFS image to it, it will be reformatted as NTFS)
  3. Use NetRestore to restore the HFS+ partition from your Mac OS X master image
  4. Use NetRestore to restore the NTFS partition from your Windows master image
  5. When you reboot into Windows, a filesystem integrity check will be performed and the machine will reboot. Upon the second reboot, machine specific settings will be applied by the SysPrep utility.

An Automated Method

  1. Install NetRestore onto a bootable Firewire or USB hard drive running Leopard, or create a NetInstall-Restore set on a machine running Leopard.
  2. Launch NetRestore and configure it for a Dual-Boot Deployment. Choose "Preferences" from the NetRestore menu and provide settings for each of the following options:
    • Default (Mac OS X) configuration
    • Target Disk
    • Enable full automation
    • Enable disk partitioning and restoring Windows
    • Windows partition allocation
    • Windows configuration

    Dual Boot Preferences

  3. Configure NetRestore to perform any Mac OS X-specific post-actions
  4. Boot your target Mac from the media set up in step 1
  5. NetRestore will automatically partition your target disk and restore the Macintosh and Windows master disk images
  6. When you reboot into Windows, a filesystem integrity check will be performed and the machine will reboot. Upon the second reboot, machine specific settings will be applied by the SysPrep utility.

Under the Covers: NTFS restoration

In addition to a standard asr restore, NetRestore makes a few tweaks to your Windows volume to make it feel at home on its new platter. Keep in mind that NetRestore does all of this for you, you shouldn't need to touch a Terminal Window to deploy a dual-boot Mac.

Starting with this information:

target="/Volumes/Windows"
targetDev=/dev/disk0s3
root_target_dev=/dev/disk0
ntfs_slice_num=3

The dmadmin.exe file has a copy of the MBR. Strip that out and stash it in /tmp for later use.

/bin/dd if=$target/WINDOWS/system32/dmadmin.exe of=/tmp/mbr skip=216616 count=446 bs=1

The boot.ini file indicates which partition slice Windows is to boot from. We might need to update this file, so we'll copy it to read/write media.

/bin/cp $target/boot.ini /tmp/boot.ini

Next we tweak the boot.ini file to indicate the correct partition slice.

/usr/bin/perl -p -i -e "s/partition\(.\)/partition\($ntfs_slice_num\)/g" /tmp/boot.ini

Unmount the Windows volume

/usr/sbin/diskutil unmount $targetDev

Synchronize the GPT and MBR partition tables. The gptrefresh tool also restores the MBR, flags the Windows volume as bootable within the MBR table, and updates the boot sector of the root target device to point to the correct start sector of NTFS volume. The gptrefresh tool is provided in NetRestore courtesy of Tim Perfitt.

[NetRestore application package]/gptrefresh -w -a $ntfs_slice_num -f -u -m /tmp/mbr $root_target_dev

Copy a generic BCD file into a Windows Vista volume. The third-party "ntfscp" tool is required to allow us to write a file to a typically-read-only NTFS filesystem. ntfscp is a product of the ntfs-progs project, and a statically-linked binary is provided in NetRestore courtesy of Tim Perfitt.

[NetRestore application package]/ntfscp -f $targetDev [NetRestore application package]/BCD /Boot/BCD

Copy the updated boot.ini file into the Windows volume.

[NetRestore application package]/ntfscp -f $targetDev /tmp/boot.ini /boot.ini

Remount the target disk.

/usr/sbin/diskutil mount $targetDev

* Deployment tips

There are a few things to keep in mind when deploying NTFS volumes:

  • Post-actions will have limited utility because NTFS is read-only on Mac OS X
  • For System Administrators that are accustomed to performing all machine customization as post-action scripts, this may pose a challenge. Fortunately, the Microsoft SysPrep tool performs most of the functions you may need as a "first-boot" script so you can still deploy a fully automated solution. I encourage you to use SysPrep to replace the functionality of post-restore configuration.

  • Be conservative when allocating space to Windows on the Master machine
  • NetRestore can always restore a Mac OS X or Windows volume to a target volume that is larger than the master, but it is not able to restore an NTFS-formatted volume to a target volume that is smaller than the master volume. (The same is not true for an HFS+ volume as long as you use NetRestore Helper to create the master image.) Consider the following example:

    On your Master machine, you have a 160GB hard drive. You've allocated 50% to Mac OS X and 50% to Windows, so you have two 80GB partitions. On your target machines, you decide Windows doesn't need that much space, so you give it only 25% (120GB for Mac OS X, 40GB for Windows). NetRestore will not be able to restore your master Windows volume to the target volume because the Master volume size is larger than the target volume size. If your Windows installation will only take 5GB, then it is a better idea to allocate only about 10GB to Windows on your Master machine. This will ease the allocation requirements for your target machines, because the 10GB volume can be restored to any target partition that is at least 10GB in size.

History:
5/9/2006: Initial publication
5/26/2006: Fixed a couple typos and added a step about determining how small an NTFS partition can be made when resizing a source volume prior to image creation.
6/22/2006: Added some more detail around Windows master partition configuration in regards to running SysPrep.
2/18/2008: Overhauled for Leopard.
11/17/2008: Added NetRestore retirement notice.

footer shadow