Who can afford to keep upgrading their hardware?
For many years now I have been an avid user of Virtual Machines with VMware workstation in particular. The Snapshot facilities VMware provides has been invaluable in being able to protect my installations when performing potentially damaging actions to my system such as installing new software or running custom applications during development.
Like many developers, performance has always been an issue with this, particularly when you are using a laptop PC with slower drives and limited RAM.
Whilst it would be great to be able to invest in the latest and greatest hardware with Solid State Drives and lots of RAM, this is not necessarily feasible for all of us.
So the question is, how do I get the most out of my current laptop without spending lots of money.
My friend and colleague David Marsh showed me what he is doing to solve this problem and it made a lot of sense to me. However, it took me a little while to work out how to get it all working, so I thought I would share my experience to perhaps save others some time and pain.
Microsoft have a utility called Imagex which ships as a part of The Windows® Automated Installation Kit (AIK) for Windows® 7.
Imagex allows us to CAPTURE a partition saving it to a WIM file. It is a file based capture which means that it provides flexibility to be able to APPLY the image without the target partition having to be physically the same size.
So the idea here is to use imagex to provide a ‘snapshot’ like capability. I can at any time CAPTURE my dev server partition to an external drive and if I need to go back, I can just format the partition and re-APPLY the image.
Now the instructions for this can be a bit misleading in this scenario. I trawled through documentation and downloaded the WAIK toolkit. There were numerous references to booting from a WPE CD and running SYSPREP all of which I tried. But this just got me into trouble, and for a while I gave up and went back to my virtual machine.
With the impending release of the SharePoint 2010 beta and being thoroughly fed-up with waiting for my VM, I decided to give it another go. I checked with David and discovered that you don’t need to use SYSPREP or boot from a WPE disc. All I needed was the IMAGEX.EXE and WIMSCRIPT.INI files from the WAIK toolkit. (the other 1.5GB of software in WAIK isn’t required).
Of course if you are APPLYING an image to different hardware, this might not work without the SYSPREP etc. (One other thing I did in my travels working this all out was using VMware Physical to Virtual to pull the OS into an Virtual Machine when I needed to run it on different physical hardware.)
My specific scenario
Now I have a Lenovo T60P which is a 64 bit machine with 3GB RAM and a 100GB 5400RPM hard drive.
I can’t add any more RAM as 3GB is the limit for this model.
100GB is just not enough for what I want to do, so I invested in a new 320GB 7200RPM hard drive (approx A$140). I was impressed that I could just plug it in and it just worked.
I then proceeded to install Windows 7 64-bit on it and was amazed at the difference to my previous XP installation. Sleep just worked! It was FAST! My Vodafone 3G USB connection improved dramatically. I was a happy camper.
Now, what to do with all of this disk space?
I dedicated half of my 320GB to Windows 7 and my normal workstation activities.
I then added two additional partitions of almost equal size and assigned them a drive letter.
I installed Windows Server 2008R2 64 bit onto the second partition (f:) and then had a dual boot machine working nicely. I installed the Vista video driver and got the OS roles and features installed that I want for my base image. This included the Desktop experience so that I can configure the Aero themes.
If you are working with drive partitions, make sure you have adequate backups before you start. I had a normal Windows image backup of my primary Windows 7 partition as well as normal file level backups. There is the potential for loss so try this at your own risk.
CAPTURING and APPLYING the image
To setup the boot configuration on the machine the way I wanted, I actually ran the Windows 2008 R2 installation on the G partition. I was being lazy, and I expect there are alternative ways to get the partition into the list of bootable OSes. Once that was done, I used BCDEDIT to change the descriptions on the two Windows 2008 bootable partitions in the list.
Then I re-formatted drive G so it was blank.
Once I had the OS in a state that I was happy with, I booted back into my Windows 7 OS.
I copied imagex.exe and wimscript.ini into a folder.
Drive F was the source partition that I wanted to CAPTURE and drive G was the blank partition.
I attached the external 1TB USB drive which I am using for my backups. (Drive E)
I started a command window using ‘Run as administrator’
Change to the folder that contains the IMAGEX.EXE and WIMSCRIPT.INI file.
I issued the following command:
imagex /boot /verify /compress fast /capture f: e:\images\w2k8r2base.wim “Windows2008R2Base”
This proceeded to create the WIM image on the external hard drive. This took about 30 minutes to create.
Once I had the image created, I wanted to test it out. I decided to APPLY the image to the blank drive G.
To do this I issued the following command:
imagex /apply e:\images\w2k8r2base.wim 1 g:\
The first time I tried this exercise, I hadn’t added the /VERIFY flag to the CAPTURE command and the APPLY failed saying that the image was corrupt. After I used the /VERIFY flag on the CAPTURE, I didn’t have that problem again.
Once the image was applied to drive G, I rebooted and selected that OS from the list of bootable OSes, and voila, it started up perfectly.
Where to now?
I am now in the process of refining my base OS installation. I have installed SQL Server 2008 with SP1 and I plan to add all of the applications that I normally use BEFORE I install Visual Studio 2010 beta 2 and SharePoint 2010 and Office 2010 beta.
I will image the baseline system with SQL so that when subsequent Beta editions of SharePoint and Office 2010 are released, I can simply format the partition and reapply the base install and install the new betas. If I am doing something to my installation that I consider risky, I’ll simply image it again before I do it so I can return to where I was in the case of a failure.
I am sure I will continue to use Virtual Machines in some circumstances, but this approach should improve my productivity and allow me to use the maximum capacity of my laptop. David has spoken very highly of his experience with this approach and I am looking forward to trying out the SharePoint 2010 beta!