Sunday, June 5, 2011

Windows 7 on Mac OS X through Virtual Box

Using Windows 7 installed in a Bootcamp partition from Mac OS X simultaneously

This guide will help you set up access to your Windows 7 installation directly from Mac OS X. You can follow this simple guide without technical knowledge and get your Windows 7 Virtual Box, up and running without any hassle. What all you need to do is, “Follow the guide blindly”.

Software Required: Virtual Box 3.2.6 or later

Time Required: 30 mins

Things we will do in this guide:

  1. Prepare the Mac system for installation
  2. Configure Virtual Box for the first boot
  3. Install Virtual Box Guest Additions for seamless full screen usage
  4. Install Audio Drivers in Windows 7
  5. Use connected USB Devices in Windows 7
  6. Setup Shared Folder between Mac and Windows 7 and access it
  7. FAQs
    1. Virtual Box Errors
    2. Fatal: No Bootable Medium Found! System Halted.
    3. Windows “Blue Screen of Death”
  8. References

1. Prepare the Mac system for installation

Before configuring Virtual Box, we need to prepare Mac OS X to work seamlessly with Windows 7 Partition. For that, the Bootcamp drive should be unmounted every time we work with Virtual Box. Following steps will guide you to unmount the Bootcamp drive by default whenever you start your Mac OS X.

Open a Terminal window and type the following command:

$sudo vi /etc/rc.local
Password:
Enter the Admin password.

It opens rc.local file in vi editor. To make changes to the existing or newly created file, you need to type “ i “ (small i without quotes) and enter the following in two separate lines:

diskutil umount /Volumes/BOOTCAMP
sudo chmod 777 /dev/disk0s3

After that you need to press “esc” and type “ : “ (without quotes) and type “ x “ (without quotes).

Now type the following to check whether the procedure you have done is right or not:

$cat /etc/rc.local

The following output should appear:

cat command to check rc.local file
cat command to check rc.local file

Then check whether the file has appropriate permissions by typing the following:

$ls –l /etc/rc.local

The following output should appear:

ls -l command to check the file permissions
ls -l command to check the file permissions

If the permissions are not like –rw-r-r-- , then change the permissions by typing the following commands:

$sudo chown root:wheel /etc/rc.local
$sudo chmod 644 /etc/rc.local

Restart the system

The above steps will unmount the Bootcamp drive permanently. If you don’t want to unmount the Bootcamp drive permanently, you can unmount that temporarily by typing the following commands without following any of the above steps:

  1. First Eject Bootcamp drive by right clicking on the drive and clicking “Eject”
  2. Type the following to make it workable with Virtual Box:
$sudo chmod 777 /dev/disk0s3

You have successfully completed the process of configuring your Mac OS X for the installation.

2. Configure Virtual Box for the first boot

Open Terminal Window and type following command (Make sure that the command is in a single continuous line):

$sudo VBoxManage internalcommands createrawvmdk -rawdisk /dev/disk0 -filename win7raw.vmdk -partitions 3

If you are facing problems, copy and paste the command from here:

sudo VBoxManage internalcommands createrawvmdk -rawdisk /dev/disk0 -filename win7raw.vmdk -partitions 3

It will create 2 files, “win7raw.vmdk” and “win7raw-pt.vmdk” in your root directory. After the successful creation of the files, type:

$sudo chown [admin-user-name] *.vmdk

The most difficult steps of the configuration are complete.

Now, open Virtual Box.

  1. Click on “New”
  2. Click “Continue”
  3. Type the name “Windows 7” and select “Microsoft Windows” and “Windows 7” if they are not selected automatically.
  4. Set your RAM of at least 1 GB
  5. Check “Boot Hard Disk” and check “Use existing hard disk”
    1. Click on “Browse” button
    2. Click “Add”
    3. Go to your root folder and select “win7raw.vmdk” and click “Open”
    4. Click “Select”. If any errors occur, please check you have completed all the procedures specified in Step 1.
    5. Click “Continue”
    6. Click “Done”

Now, you need to attach your “Windows 7” partition to this Virtual Machine you have created.

  1. Select your “Windows 7” Virtual Machine
  2. Click on “Settings”
  3. Click on “Storage” Tab
  4. Select IDE Controller
  5. Click “Add Hard Disk” which will directly add your “win7raw.vmdk”
  6. In the “Attributes” column of “Storage” tab, set “Type” as “ICH6”
  7. Click “Ok”
Attach Disk Controller to Virtual Box
Attach Disk Controller to Virtual Box

You have successfully configured your Virtual Box with your Windows 7 Partition.

Successfully configured Virtual Box for Windows 7
Successfully configured Virtual Box for Windows 7

Click on “Start” to boot your “Windows 7” partition and allow it to install all the necessary drivers after login to your windows account.

Here, typically the window size is set to a resolution of 800x600. You can maximize your resolution by following the step 3.

3. Install Virtual Box Guest Additions for seamless full screen usage

Virtual Box Guest Additions are required for High Resolution Video Support, Time Synchronization, Seamless Windows, Shared Folders, Mouse Pointer Integration, Shared Clipboard and Automated Logons.

If you have already tried putting your virtual machine on full screen mode and didn’t get the resolution better than 800x600 or some standard resolution, here is the solution:

  1. Go to the “Applications” folder in your Mac OS X
  2. Locate Virtual Box Package
  3. Right click on the Virtual Box and click on “Show Package Contents”
  4. Browse through and locate “ContentsĂ MacOSĂ VBoxGuestAdditions.iso”

Now, start your “Windows 7” from Virtual Box

  1. Locate “Devices” in the Menu Bar of the Windows 7 Virtual Box
  2. Click on “CD/DVD Devices”
  3. You will be able to see “VBoxGuestAdditions.iso” file. If you are not able to see it, click on “More CD/DVD Images” and browse for the VBoxGuestAdditions.iso from the folder specified above.
  4. Now find the “VBoxGuestAdditions.iso” mounted as a CD in “My Computer” of Windows 7
  5. Open the drive and click on the appropriate package (32-bit and 64-bit) installer.
  6. After the installation, restart your Windows 7 System.
  7. After restart, Login to the Windows 7
  8. Now click on “Machine” on Virtual Box menu bar and select “Enter Fullscreen Mode” or press Host Key+F

:) You should be able to see your “Windows 7” running in full screen mode with maximum resolution.

4. Install Audio Drivers in Windows 7

I use a Mac Book Pro running on OS X 10.6.2. I faced problem with my audio driver. So I thought of helping the guys facing the same kind of problem with Windows Audio Drivers.

Following are the steps:

  1. Go to “Control Panel”
  2. Select “Device Manager”
  3. You can see your Audio Driver being highlighted for no drivers
  4. Right Click on it and select “Update Driver Software”
  5. Allow it search online
  6. It will automatically download the software and install it.
  7. Restart Windows 7 and you will be happy to hear the Welcome note @ Login Scree

5. Use connected USB Devices in Windows 7

If you have checked that the USB devices which you have connected to your MAC, are not accessible from Windows 7 or, if you are not able to select it from the USB Devices List (Grey Device or the device name is Grey-ed), please follow this procedure.

  1. Shut down your Windows 7 System
  2. Select Windows 7 in Virtual Box
  3. Click on “Settings”
  4. Click on “Ports” tab
  5. Check “Enable USB Controller” and “Enable USB 2.0 Controller”
  6. Click on “Add USB Filter” with all the fields set to empty. If you set all the fields empty, Windows 7 will be able to access all kind of devices, which you attach to the system.
  7. Click “Ok”
  8. Remove all the devices which you want your Windows 7 System to access
  9. Start Windows 7
  10. Make sure that your mouse is in Windows 7 Window
  11. Now attach the USB device.
  12. You can see that your USB device will be installing its drivers comfortably in the system tray.
Adding USB Filters for connecting USB Devices in Windows 7
Adding USB Filters for connecting USB Devices in Windows 7

This completes the section of installing USB Devices

6. Setup Shared Folder between Mac and Windows 7 and access it

  1. Shut down your Windows 7 System
  2. Select Windows 7 in Virtual Box
  3. Click on “Settings”
  4. Click on “Shared Folders” tab
  5. Click on “Add a New Folder Definition”
  6. Browser for the folder which you want to share
  7. It will get directly added to your Machine Folders list
Adding a Shared Folder between Mac OS X and Windows 7
Adding a Shared Folder between Mac OS X and Windows 7

You have successfully added a Shared Folder

You can access the folder by typing the following command in the "Run" dialog box:

\\vboxsvr\[folder-name]

7. FAQs

  1. Virtual Box Errors

    1. Check properly whether you have unmounted Bootcamp drive
    2. Check whether you have given proper permissions to the Disk0s3
$sudo chmod 777 /dev/disk0s3

C. Check whether you have given appropriate ownership to the *.vmdk files

$sudo chown [admin-user-name] *.vmdk

2. Fatal:No Bootable Medium Found! System Halted.

Check whether you have attached the IDE Controller Properly in the “Settings” Menu of Virtual Box

3. Windows “Blue Screen of Death

Check in “Settings” Menu of Virtual Box whether the “Attributes” column of “Storage” tab, set “Type” as “ICH6”

8. References

http://dashes.com/anil/2009/10/how-to-run-windows-7-under-mac-os-x-106-for-free.html

http://www.microsoft.com/windows/windows-7/

http://www.apple.com/macosx/

http://blog.brianguy.com/2009/11/automatically-unmount-boot-camp.html

http://bloggy.kuneri.net/2008/05/16/how-to-share-files-with-virtualbox-between-mac-and-windows/

http://forums.virtualbox.org/viewtopic.php?f=2&t=11729

http://www.virtualbox.org/ticket/495

*********End of Article**********

Excuse me for any mistakes

Thank you very much :) - Viplav (Lucky)