Taming virtual machines with best practices – Part 1 of 3
Sunday 11 January 2009 - Filed under Tech Notes
In continuation of my earlier post regarding setting up a SharePoint lab with virtual machines, here I have put together a collection of awareness notes and best practices for dealing with virtual machines in general. When I say “in general,” I refer to the personal, experimental, or small-business setup for developers, engineers, and consultants who operate a virtual lab out of one or more laptops each equipped with 4-8GB of RAM.
640MB should be enough for everybody?
Firstly, here are things to take into consideration before building a virtual machine (VM):
- Hard disk size: Set the maximum hard disk (partition) size to a value that can comfortably accommodate what you’ll be using it for. There is no harm in setting it high; it’s only a theoretical maximum and not a fixed amount of storage space the VM image will occupy all the time. Increasing the upper bound at a later stage can be done but it’s not a trivial task. As a general guideline, give your Windows XP VM and Windows Server 2003 VM at least 20GB and 30GB, respectively.
- Amount of memory (RAM): Unlike hard disk storage, you can’t afford to be endlessly generous when it comes to the amount of RAM your VM’s can have. Make sure you have a clear idea about the memory requirements of the software you will install on the machine and also the projected usage, i.e. the number and types of concurrent user connections to the virtual machine. Normally, a Windows Server 2003 VM that is also a domain controller performs reasonably well with around 768MB of RAM. Installing things like SQL Server and SharePoint Server on top of it requires an extra 256-512MB. Realistically, give at least 1GB of RAM to a Windows Server 2003 VM that actually does something other than just sit there quietly consuming computing power. As for Windows XP machines, 640MB is sufficient for many development tasks and 1GB is sometimes overkill. Windows Vista and Windows Server 2008 VM’s require significantly more RAM to function smoothly than their XP and 2003 counterparts. Avoid those newer operating systems if you need to run more than one VM concurrently out of a single physical (host) machine that has 4GB RAM or less.
- Memory and Windows activation: When it comes to the amount of RAM for a VM, try to be as realistic, conservative, and precise as you can upfront since you’ll have to stick to your chosen value in most cases. Don’t be fooled when you discover that it’s really easy to change the amount of allocated RAM from the virtual machine settings; every time you fiddle with it and turn the virtual machine back on, its Windows operating system counts it as a “significant hardware change” and may annul the activation of Windows, in which case your VM turns into a time bomb and causes all sorts of complications with licensing. So, unless you have a version of Windows that does not require activation, be very careful and decisive about the amount of RAM you allocate to the VM.
- Lost memory: Truth be told: 4GB RAM ain’t 4GB in 32-bit Windows operating systems. Unless your host Windows OS is 64-bit, the maximum amount of RAM that can be used by your guest VM’s is somewhere between 3.25GB and 3.5GB. If your laptop has integrated graphics that shares the main memory, the usable memory is further reduced by up to 256MB depending on the hardware specs. That’s not all; the Windows OS of your host machine requires hundreds of megabytes of memory in order to function even if you do nothing but run VM’s on it. Windows XP typically takes up about 300MB while Windows Vista gobbles up a whopping 900MB just to start up. This results in a significant difference in the total amount of RAM that can be allocated to VM’s among different host machines that equally have 4GB of physical RAM. A laptop that has 4GB of RAM, Windows XP, and discrete graphics, for example, can make just over 3GB of RAM available to VM’s. Another laptop with 4GB of physical RAM, Windows Vista, and integrated graphics, on the other hand, may only have around 2.2GB of RAM left over for VM’s and all other applications. If you are buying a new laptop, examine the hardware and software specs carefully. What about the MacBook Pro? Yes, it’s 64-bit, which means all 4GB of physical RAM is usable, but the Leopard operating system itself takes away a good 1GB of RAM.
- External drive: For better performance, store and run VM’s on an external hard drive connected via USB 2.0, Firewire, or e-SATA. Create a dedicated partition for VM’s and frequently used software installation files. On average, a single VM requires up to 20GB of storage when fully configured and in operation. Hard disk storage is cheap; get a bigger drive if you need to.
- File system interoperability: Most virtualisation software provide the option to split virtual machine image files into 2GB chunks. This is useful for non-NTFS hard drives and switching between different host operating systems. If you need to plug the same VM into both Windows and Mac OS X host machines, for example, choose to split the VM into 2GB chunks. If not, still split it into 2GB chunks because it’s just not easy to handle a single file that stretches over dozens of gigabytes of disk space.
Although it may sound burdensome and complicated, creating a VM is actually a relatively straightforward task once you are confident that you know what you are doing. Part 2 of the discussion will cover things that need to be checked and done while the virtual machine is in operation.
2009-01-11 » JK
13 February 2009 @ 17:46
[...] Taming virtual machines with best practices – Part 1 of 3 [...]