My ideal developer machine running RHEL 5.5 and Windows 7

UPDATED 12/9/2010: As I suspected, I do have some file writing corruption writing large files and folders to the NTFS partition via the Windows 7 virtual machine. I added the details below
********************************************************************************************************************************

Since my job involves doing R&D work on everything from statistical modeling to embedded medical device systems, one of the benefits (and curses) is getting a powerful laptop and a green light to set it up how I want. In my case, it was a HP EliteBook 8440p with a Core i5 560M processor, 8GB of RAM, 320 GB hard drive, NVidia NVS 3100M video card (for CUDA programming), and eSATA to store virtual machines on external drives. With my fancy new machine in hand and some 64 bit copies of Windows 7 and Red Hat Enterprise Linux (RHEL), the big question...how exactly do I want to set this machine up, knowing that realistically I will be stuck with the configuration for a long time once I start using it. And so after numerous hours and reinstalls (partially due to my lack of in-depth Linux knowledge at the start), I detail my setup to hopefully assist others attempting the same task and save them some pain.

Early in my testing phases, I realized that just a RHEL 5.5 server running a Windows Virtual Machine (VM) was not going to cut it. Sometimes I need the ability to dig into Windows and get access to the native hardware...especially with NVidia CUDA. There were also Windows only software packages that I needed to run with better support, especially geospatial software. As such, I knew I needed to go down the dual boot path, but I wanted to primarily run in RHEL with a Windows VM, so I wanted to be able to share files between the VM and the native Windows. The downside to this is that it requires 2 Windows 7 licenses. Finally, I also decided to use KVM over Xen for virtualization because (1) RHEL was discontinuing support for Xen in v6, (2) NVidia drivers only work with the native kernel, hence they do not co-mingle with Xen.

Given these requirements and the numerous iterations with installing and evaluating the setup, the path I finally took was this:

Hard Drive Partitioning
Given the maximum of 4 partitions on the hard drive, I went with

  1. Windows 7 Reserved Partition (100M)
  2. NTFS Partition for Windows (160G)
  3. Linux Boot Partition (1G)
  4. Linux Logical Volume Manager (LVM) (140G)

The Linux LVM contained the following partitions:

  • Linux root partition (10G)
  • Linux swap partition (9G)
  • ext3 Storage partition (120G)

Installing the Software

  1. Install Windows 7 64-bit Professional Edition and let it claim the entire hard drive -- Linux plays much nicer with other Operating Systems, so without getting into it here, just trust me on this one (but feel free to ask). This should result in partitions 1 and 2 being created.
  2. Shrink the Windows 7 partition to the 160G I planned on giving it.
  3. Install RHEL 5.5 64 bit. During the installation process, create partitions 3, 4, and the logical partitions in the LVM. Also, make sure to install Grub to the Master Boot Record, and rename the "Other" entry to something more useful (such as Windows 7 x64).
  4. Boot to both Linux and Windows and install any drivers you need. This is a whole other story for Linux, especially with NVidia drivers and the Intel 6000 Wireless not working out of the box. Hint 1: if virtualization and nVidia are goals, choose KVM over Xen. Hint 2: RHEL Supplementary Library can be a life saver here.
  5. Boot into Linux, and install Fuse and NTFS-3G. In RHEL, the command yum install fuse fuse-libs, followed by downloading and installing the RHEL5 RPM package from http://packages.sw.be/fuse-ntfs-3g/ did the trick.
  6. Create the mount point for the Windows partition (#2). I chose to use /mnt/win7, so I called the following 2 lines from the shell
    mkdir /mnt/win7
    mount -t ntfs-3g /dev/sda2 /mnt/win7
    Finally, in order to mount this at startup, I edited the /etc/fstab file to include at the end of the file
    /dev/sda2 /mnt/win7 ntfs-3g defaults 0 0
  7. My next goal was to set up my Windows VM. First, I installed the Windows guest paravirtual drivers for Windows through
    yum install virtio-win
  8. Next I created the Windows 7 64 bit virtual machine using the virt-manager tool in RHEL (30G of disk space allocated). I made sure everything was updated and running correctly.
  9. I changed the CDROM drive on the virtual machine to the virtio-win ISO file for the VM and installed the drivers from the new CD-ROM that Windows detects.
  10. I took down the VM, remapped the network drivers to use the virtio drivers, and added a physical storage entry to the VM using the virtio drivers to partition /dev/sda2. This allows the VM to access all the files used by the native Windows 7 boot by adding another drive (E: in my case) pointing to the NTFS partition on the hard drive. (WARNING: This is problematic as we are bypassing the NTFS-3G drivers. I've experienced file loss with large, deep folder trees and certain large files such as ISO files. I am trying to find a way to have KVM use the NTFS-3G driver, though copying the files via the Windows boot or with Samba should work fine. I'll continue to update as I learn more.)

I hope this helps others feel at least a little less of the pain I felt in doing this. If you have any questions, please feel free to contact me on Twitter or at the email address in the footer.