Papa's Perspective

Running Windows 8 in a Virtual Machine

The advantages of using virtualization, and specifically VirtualBox, to develop on the Windows 8 platform.

Windows 8 has a lot to offer to developers, whether your skills lie in HTML5, XAML or even C++. The bits for the Windows Developer Preview are out and you likely want to give them a test drive, but you also want to be careful to get up and running quickly without affecting your existing system. So if wiping your PC and installing Windows 8 Developer Preview on it isn't an option, here are two alternatives.

Virtual Hard Drive Options

If you want great performance and an isolated OS that doesn't affect what's already on your PC, installing a Virtual Hard Drive (VHD) on metal is a great option. There are two ways to do this, and it really depends on whether you're willing to wipe your partitions first or not (thus obliterating what's on the drive).

If you're willing to clean the partition first, the advantage is that you can create multiple VHD files for multiple OSes and boot from any of them. You are then running right off the metal, so the performance is great. Plus, your OSes are all contained within a single VHD file, limiting the risk of one OS going down and affecting the others.

However, if you already have an OS on your PC and want to try booting from a new VHD, you can still do that. Your existing OS won't be as isolated from the VHD, but it's still a workable option. My recommendation is to wipe the partition clean first if you can. You can refer to this blog post that explains in detail how to get an OS up and running on metal.

But perhaps you want another option which is easy to get going and to get rid of when you're done. That's when running the OS as a virtual machine (VM) in a program like VirtualBox can be great. I like VirtualBox because it's free, supports multiple OSes (including Windows 8), is easy to set up, and flexible.

VirtualBox

VirtualBox follows the "keep it simple" guideline. I haven't been able to get a VM as responsive as running off the metal, but there are ways to squeeze out extra performance to make it very usable. Plus, since Windows 8 works best on widescreen resolutions, VirtualBox is great since it allows configurable screen resolutions. In fact, Dan Wahlin and I have been using this technique for some Windows 8 videos we've been recording.

Start by downloading and installing VirtualBox, then downloading the Windows 8 Developer Preview iso file. You'll also want to download and install the VirtualBox Extension Pack if you want to use any USB 2.0 devices. Run VirtualBox and click the New button to create a new virtual machine. Enter a name for your virtual machine such as "Win8 Preview" and select Windows 8 (64 bit) as your Windows version, as shown in Figure 1.


[Click on image for larger view.]
Figure 1. Naming the VM and listing Windows 8 as the version.

Click Next and set the memory (Figure 2) to at least 2GB of RAM, but if you can afford it you should give it 4GB.


[Click on image for larger view.]
Figure 2. Configure at least 2 MB RAM for your VM; 4 MB is even better for performance.

Click Next, indicate that you want to use a start-up disk and create a new hard disk. Click Next again, and select a VDI for a VirtualBox Disk image, as shown in Figure 3. You can select one of the other options, like VHD, but I've found the most success with VDI. Click Next and select either dynamically allocated or fixed. I recommend dynamically allocated so you don't get stuck with a limit, but fixed offers better performance, if that's a priority. Click Next and choose the location of the virtual machine and its size. Click Next and then click Create.


[Click on image for larger view.]
Figure 3. Choosing VDI in this step yields good results.

Now that your VM's created, select it in VirtualBox and click the Start button in the toolbar. When the First Run Wizard appears, click the Next button and select the iso file (Figure 4) for the Windows 8 Developer Preview you downloaded earlier. Then click the Next and Start buttons. Once the setup process for Windows 8 begins, follow the prompts as you normally would.


[Click on image for larger view.]
Figure 4. Your installation media in this case is the Windows 8 Developer Preview .iso file.

Once the VM's running, there are some key settings you should consider tweaking. First, to boost performance, set the RAM to 4GB if you can spare it. You should also go to the Settings window, select the Display option and check the options to enable both 3D and 2D acceleration, if applicable. Then crank up your video memory to at least 128MB of RAM, as shown in Figure 5. For some reason all of my VMs start out at 1MB, which just won't cut it on Windows 8 (or much else with animations, for that matter).


[Click on image for larger view.]
Figure 5. Adjust video memory to at least 128 MB, if you can spare it, for best performance out of your VM.

You might also want to go into the Settings window and choose the System option, then the Processor tab. Use at least two CPUs, if you can spare them, as shown in Figure 6.


[Click on image for larger view.]
Figure 6. If you're on a multi-core machine and can spare CPUs, utilizing more than one can have a dramatic impact on performance.

After changing these settings, I received dramatically better performance from my VMs running Windows 8.

Using VirtualBox is a nice option because it's easy to get going and is completely isolated. You'll get lesser performance than installing on metal (using the first option I mentioned), but it's great option to use with a VM, which has advantages like snapshots and rollback to specific machine states.

About the Author

John Papa is a Microsoft Regional Director and former Microsoft technical evangelist. Author of 100-plus articles and 10 books, he specializes in professional application development with Windows, HTML5, JavaScript, CSS, Silverlight, Windows Presentation Foundation, C#, .NET and SQL Server. Check out his online training with Pluralsight; find him at johnpapa.net and on Twitter at twitter.com/john_papa.

comments powered by Disqus

Reader Comments:

Mon, Jan 28, 2013 Moon carinsurance 3332 eastwood auto insurance 31375 propecia >:PPP

http://www.onlinecheapautoinsurance.net/ DOT 3332 http://www.quotesfromtopinsurers.com/ DOT 31375 http://www.treatpatternhairloss.com/ DOT >:PPP

Wed, Jun 6, 2012 JW Boston, MA

For those who asked "Why not Virtual PC?", well, one answer would be that the author was using Windows 8 x64, and Virtual PC has never supported 64 bit guest OSes. VirtualBox, by contrast, has supported 64 bit guest OSes for ages now...

Thu, Feb 16, 2012 DClark

@David Despres
If it's been some time since you've tried Virtual PC, I recommend you give it another shot. In my experience, Virtual PC performs markedly better than Vmware Desktop on my laptop with Core2 Duo @2.8ghz and 4gb ram.

Wed, Nov 30, 2011 Mutui

We may have XP Mode installed on our win7 machines.

Tue, Nov 15, 2011 Charley Jones, PMP, MCDBA, MCAD, ... Las Vegas, NV

I found that installing directly to a second partition on my dev laptop worked very well, and had none of the lag of the vm. Windows 7 seems to work cooperatively with Windows 8 Preview. System seems to see 2 bootloaders and uses them alternatively. Suggest you google if you want to see the process.

Tue, Nov 8, 2011 Mark Burnie Guildford, UK

Thanks for the tips on getting Windows 8 up and running. I have to say that I am really looking forward to getting my hands on a tablet with this OS running on it.

Mon, Oct 31, 2011 John Papa Orlando, FL

DEVENDER I am using VirtualBox 4.1.4 r74291 John

Mon, Oct 31, 2011 Devender Hyderabad, India

I have downloaded VirtualBox-4.1.4-74291-Win.exe and unable to find OS Version : Windows 8(64 Bit) in the options. Please update on which version of Virtual Box are you using?

Fri, Oct 28, 2011

vmWare 8 was a very buggy release -- Many of us had to uninstall and go back to version 7. Be prepared. Have a backup of everything, because your version 8 is not backwards compatible to 7

Thu, Oct 27, 2011 Marvin Newport Beach California

If you want to use a vmWare solution, you need vmWare Workstation 8 to get the ISO installed. (Pick Windows 7 x64 as your OS.) Since there is a free 30-day trial from vmWare, this is not a problem. After you get it installed, vmWare Player 4 will run it just fine. Note that older versions of either product don't work.

Thu, Oct 27, 2011 David Despres United States

Virtual PC is junk next to VirtualBox. VirtualBox is a superior product and the best part it is free.

Thu, Oct 27, 2011 Ken

Why not run it on Windows Virtual PC? Most of use probably have that installed already since we may have XP Mode installed on our win7 machines.

Thu, Oct 27, 2011

neat - oh but will legacy mgmt have budget to port legacy internal developed application from Windows XP days to Windows 8?

Thu, Oct 27, 2011 Oduwole Oluwasegun Nigeria Lagos

please i had these issue while using both virtual box and VMWare to run Windows 8. it gave an error HAL_INITIALIZATION FAILED. my system spec is HP 2.1GHz and RAM 4Gb. The Virual Machine Allocated RAM is 2GB. Please help ASAP

Add Your Comments Now:

Your Name:(optional)
Your Email:(optional)
Your Location:(optional)
Comment:
Please type the letters/numbers you see above

.NET Insight

Sign up for our newsletter.

I agree to this site's Privacy Policy.