Eggins.com
Powershell, .Net, Visual Studio, Team Foundation Server, Windows Communication Foundation

Virtual machine problems and solutions

Following on from my last post on "Reducing the footprint of your virtual Machines", this post is about some general problems that I have come across while creating my virtual machines for software development. Like I said in my last post, I prefer to develop inside a VM, as this gives me the ability to develop inside a very clean environment with only the software required for developing software. I can create a VM for each of the .Net versions that I develop for.

I currently use VMWare Server 1.0.5 for my virtualisation needs. This is a free application.

So here are the problems and their solutions: 

Problem: Windows XP by default takes up about 6GB of the available hard drive space even before the OS is installed. This bloats the size of the resulting VM considerably. The reason for the 6GB is that, assuming you give the VM 2GB or memory, XP will grab 2GB of hard drive space for the swap file, 2GB for the system restore area, and 2GB for a system hibernation area.

Solution: There are ways to remove all three of these from XP after install (see Reducing the footprint of your virtual Machines). You could also install Windows Server 2003 or Windows Server 2008 instead. These server OS's do not install the System Restore partition, nor the Hibernation area. Neither the System Restore partition, nor the Hibernation area are needed for my VM's. I would suggest leaving the swap file as it is though. If you are developing web applications, you may also have the benefit of developing your software on the same OS that you will eventually migrate your code to. If you have an MSDN universal license, you are entitled to develop your software on the Windows Server 2008 that comes with your subscription.


Problem: The VMWare UI is a little slow because it uses screen scraping to paint the UI

Solution: Use VMWare to start the Virtual Machine, but use Terminal Services to RDP into the VM. Terminal Services uses a communication method that is much faster than screen scraping. If you do not want to start VMWare and start the virtual machine each time you use a VM, you can use a batch file with the following line to start the VM. Change the path after start to the path to your VMX file. If the virtual machine is already started, this does nothing.
"C:\Program Files\VMware\VMware VIX\vmrun.exe" start "c:\VirtualMachines\vs2008\vs2008.vmx"


Problem: If you have multiple monitors, you may want the VM to span those monitors.

Solution: Install Remote Desktop Connection (Terminal Services Client) 6.0. This is an option in the windows update, or you can get it from here. Then you either start mstsc.exe with the "/span" parameter, or alternatively, start mstsc.exe, type in your VM's machine name, set any other settings you like, click the "Save As..." button, edit the resulting *.RDP file with notepad, and include the following line:
span monitors:i:1


Problem: There is a bug in Windows Server 2003 SP2 that makes RDP sessions to that client which are larger than 1600x1200 to be forced to 8 bit colour.

Solution: This is a known bug in Server 2003 SP2. Install the hotfix "KB942610" from Microsoft to fix this problem. This hotfix is only available from MS as a special request. They send you the link and password in email after you have requested it. This is because the hotfix has not been tested as rigorously as other freely available hotfixes.


Problem: When you open the Terminal Services Client with the span option, it does not know that you have two monitors. Therefore, maximising a window will maximise to both monitors, not the left or right, as is normally the case.

Solution: Install "WinSplit Revolition", a freeware utility that allows the user to use Ctrl+Alt+Num-Pad keys to move windows around the screen. For example, Ctrl+Alt+4 maximises the window to the left screen, and Ctrl+Alt+6 maxmises the window to the right screen. Kudos to Raphael Lencrerot for this excelent application.
 

Problem: The msi file for Visual Studio 2005 is a large installer, and when I ran it on Windows Server 2003, in the VM, with 1GB or memory allocated, it could not verify the msi as being error free.

Solution: This is a known bug in Server 2003 SP2. Install the hotfix "KB925336" from Microsoft to fix this problem. This is a freely available hotfix.

Problem: There was an application that I needed for development (MCMS) that requires the NetBIOS machine name to exactly match the DNS Machine Name. NetBIOS has a limit of 15 characters for the nachine name, while the DNS Machine Name has a much higher limit. When you set your DNS Machine Name to something over 15 characters, you will get a warning that the NetBIOS Machine Name will be truncated at 15 characters. This may not affect you with your applications, but it is something to consider.

Solution: To be safe, keep the machine name under 15 characters.


Problem: Disk fragmentation. The VMWare image files reside on the host hard drive. If you did not consolidate your freespace using a defragmenter tool, these files may be fragmented. Fragmented VMWare image files will adversely affect the performance of the virtual machine. Also, as this image file is a virtual hard drive, the files within it can also become fragmented. Having a badly fragmented host drive and a badly fragmented guest VM drive will affect the overall performance of the Virtual machine dramatically.

Solution: I have found an application that can solve both of these fragmentation problems in one go. It is only required to install it on the host. It will defragment the host drive, and all VMWare guest files in all VMWare guests, in one action. The application is called PerfectDisk. It is not cheap, but in my opinion, it is worth it for the extra speed.

Problem: If you copy a VMWare image, and plan to use both the original and the copy at the same time, you may have some trouble with networking.

Solution: For a start, you should change the machine name. If you have set the original VM to have a fixed IP address, you will also have to change that IP address on the new clone. Beyond that, I would recommend at least running NewSID, which will change the Computer Security Identifier, and also has an option to change the machine name. This is the least invasive way to change the identity of a machine name. Alternatively, you can run the SysPrep tool from Microsoft. The SysPrep tool changes a LOT more items in the OS, so I would recommend having a copy of your VM before running SysPrep. Please read the instructions on the SysPrep page before running it on your VM. Also, read more about this topic from Microsoft TechNet.


Problem: Windows Server 2003 and 2008 both allow two logon's by Terminal Services, and one at the console. If you use the Terminal Services Client to connect to a Windows Server 2003 VM, it will not connect to the console by default, but to one of the available Terminal Services Sessions. If you were connected to the console via the VMWare interface, you now have two logins to the same machine. If you then connect again with another Terminal Services Client, you will have three concurrent logins to the same machine, potentially all with the same userid. This is not useful in my case, and I always just want to log in to the console itself, so that I can easily swap between the VMware interface and the Terminal Services Client inteerface.

Solution: I edited the RDP files with notepad and added the following line below. This makes the connection to the console. If you want to connect using one of the two available Terminal Services connections in Windows Server 2003, you can create another RDP file without this line, or just use the Remote Desktop Connection link in your Start menu. Please note that Server 2008 behaves differently, and does not seem to require this setting. If you log onto a Server 2008 VM using the VMWare Interface, and then log into that same VM with the same credentials using Terminal Services Client, you will be handed the initial login from within the VMWare interface, even without the following line.
connect to console:i:1


Problem: Windows Server 2003 and 2008 do not allow you to shut down the server without first logging on. This can be an issue if you start the wrong VM, or if you accidentally log off the VM using RDP instead of shutting down, and then want to use the VMWare iterface to shut down the VM without waiting for the logon and logoff process.

Solution: Start > Run > gpedit.msc. Browse to: "Computer Configuration\Windows Settings\Security Settings\Local Policies\Security Options\". Double Click "Shutdown: Allow system to be shut down without having to log on". Set to Enabled. Now the "Shutdown…" button will be allowed in the login form.


Posted Apr 08 2008, 08:08 PM by David

Add a Comment

(required)  
(optional)
(required)  
Remember Me?
Copyright eggins.com, 1998 - 2008
Powered by Community Server (Non-Commercial Edition), by Telligent Systems