This article is a supplement to the three-part article entitled "TG Daily Special: Virtualization". In this article we'll go through the entire process of setting up a virtual machine. You'll learn what software is required, what hardware should be used and, as a companion to the three-part article, why it is desirable to do so.
Take some time to read through this article and prepare yourself to enter the exciting world of virtualization. Possibilities abound.
For our example we'll create a 10 GB virtual machine on an Ubuntu-based Linux box. VMware is also available for Windows, but, in my personal opinion, it really defeats the purpose of running virtualized machines if you're going to do it in Windows. We are looking for an efficient foundation and Linux is a lot leaner than Windows. I believe the better solution is to have a small footprint host, and leave extra resources for the multiple guests. In addition, Linux is free which means you can you have it on all of your pieces of hardware (desktops + notebooks machines) without having to use up your licenses.
In my experience, the amount of hard drive space you need to physically allocate for the virtual machine is limited only by the encapsulation you want. If you want an open machine, then you really only need enough for the OS + apps. But if you desire a fully encapsulated machine, then give it the full hard drive space you see yourself using with the OS, apps and data files (MP3s, videos, whatever else).
Using today's 500+ GB drives, virtual machines of 80 GB or larger are definitely possible. Using those large drives won't notably slow the system down. However, the bigger the virtual hard drive, the longer it takes to setup initially. 10 GB is pretty much a happy medium in my experience as the OS consumes about 2 GB or less. That leaves plenty of room for installed software and some data files. Of course, adjust up or down as necessary for your needs.
VMware for both Windows and Linux is free, and it comes in two forms. VMware Server is the version you'll likely want to install as you can create virtual machines with it. VMware Player is the other. It's a thinner, lighter version, but it only plays virtual machines and you cannot create new ones. However, this may not be a reason not to use it, if you can receive an already canned, empty-OS virtual machine (either by downloading or from a friend). Such a machine can be archived into a safe place, and then copied as needed to roll out new virtual machines.
Running a virtual machine requires two steps. First, you create the virtual machine. This only needs to be done one time and is somewhat time-consuming. Formatting the virtual disk will take about as long as it does to format a real hard drive. However, once a virtual machine is created, it is just a data file. It can be copied, archived, shared, or anything else you might like to do with it. Just make sure all of your licenses are appropriate. In my example, I have two physical machines I typically use - a desktop and a notebook. After switching from Windows to Ubuntu Linux over a month ago, I now have VMware Server installed on both machines. I run Windows XP on my desktop and Windows 2000 on my laptop for the Windows versions. I have done this because I have valid licenses for both. There's nothing to keep you from using multiple copies of the operating system on multiple computers. It's just illegal to do so because of the licensing models in place.
VMware Server for Ubuntu Linux is available via the Synaptic Package Manager. If you're running Windows, download from VMware's website and run.
Once installed, it will appear in the "Applications - System Tools" menu. Go to "VMware Server Console," right-click and choose "Add to Launcher". This will put a shortcut on the launcher which can be modified to run as sudo (which may not be required on some installations).
To modify the launcher icon, right-click on it and choose "Properties". Under Command change "vmware" to "sudo vmware". Under "Type" change to "Application in Terminal". This will cause VMware to ask for your sudo password each time you launch it, which will allow VMware to have access to everything it needs.
If your machine is setup properly this will not be required, but, for the sake of this tutorial, it will make things a lot easier. Windows users should not have to do any of this. But, of course, Windows users will have to reboot before the changes take effect.
Once launched, it will come up with a screen like this. The software will ask you where to connect. Note that the ability exists to connect to remote servers. Virtual machines that exist elsewhere can be managed from VMware Server. However, for this tutorial, we will only be looking at local machines.
Once loaded, click on the "Create a new virtual machine" button. This will take you through an automated series of steps which basically asks you for everything you'll need to physically create the machine. Remember again that the machine you're creating is just a hard disk file. The settings you choose are encoded within that file, but the actual machine exists out there in the directory you will specify. It can be backed up, moved, copied, deleted, etc. - all from common file maintenance utilities like Nautilus or Windows Explorer.
I suggest that you choose the "Custom" option. It's not that much more difficult and it will give you complete control over the machine's creation. And yes, this tutorial will take you through these custom steps.
Read on the next page: Operating system options
The next screen you'll see is one asking you for the target operating system you wish to install. I'm not entirely sure what is different about the way VMware works – I have accidentally installed Windows XP on a machine I setup as Windows 2000, so there is some degree of flexibility here. However, I do suggest following the software's instructions and choosing the appropriate operating system selection for what you'll be installing.
The options are rather extensive (our version was VMware Server Console 1.0.3 build-44356.)
Windows 3.1, 95, 98, Me, NT, 2000 Professional, 2000 Server, 2000 Advanced Server, XP Home, XP Professional, XP Professional x64, Server 2003 Web Edition, Server 2003 Standard Edition, Server 2003 Enterprise Edition, Server 2003 Small Business Edition, Server 2003 Standard x64, Server 2003 Enterprise x64, Vista 32, Vista 64.
Red Hat, Red Hat Enterprise 2, Red Hat Enterprise 3, Red Hat Enterprise 3 x64, Red Hat Enterprise 4, Red Hat Enterprise 4 x64, SUSE, SUSE 64, SUSE Enterprise Server, SUSE Enterprise Server 64, Novell Desktop 9, Sun Java Desktop System, Mandrake, Mandriva, Mandriva 64, Turbolinux, Ubuntu, Ubuntu 64, and support for other Linux versions in 32-bit or 64-bit modes with 2.4.x, 2.6.x kernels, or what are simply called "Other Linux" and "Other Linux 64".
NetWare 4, 5 and 6.
Solaris 10 and Solaris 10 64-bit.
MS-DOS, FreeBSD, FreeBSD 64, Other, Other 64.
As you can see, the list of supported operating systems is very extensive. You can install virtually any OS under Vmware, provided it did not do anything particularly obnoxious with the hardware. For the majority of users, it will be a Windows or Linux install. The options there are robust enough to allow for pretty much all major versions.
Naming the virtual machine
After choosing the operating system, VMware asks you for the name. By default it's the name of the OS you chose: This will be the filename on disk. It's also the name displayed in the tab later on. I suggest shortening it. "Windows 2000 Professional" becomes "Win2Kp", etc. This step also asks you to choose where it will be created.
Take special note of two things: First, where you save it. Second, make sure you are saving it onto a Linux-based Ext2 or Ext3 file system. VMware will go ahead and create the virtual machine on a FAT32 or NTFS (assuming NTFS-3G is installed) file system for you, but it won't run from there. VMware does not give you any error messages when you try to run your virtual machine on a FAT32 or NTFS file system, it simply won't run. That's the biggest (and only) complaint I've had to date with VMware Server. And, to be truthful, I could be doing it wrong.
Number of processors
The next step asks you for the number of processors to devote to the machine. For some OSes you'll gain nothing by choosing more than one. Windows XP Home, for example, cannot use two or more processors. The extra ones will just sit there forever, idly doing nothing. Some other OSes are the same way. In my experience, and as a general rule, simply choose one processor. You'll find that the virtualization of firmware and BIOS actually makes many components of your virtual machine run faster than it does on real hardware. This will be a welcomed bonus once you get everything up and running. If you need more processing power than a single CPU, choose two.
Privacy / Access Rights
The next step asks if the machine should be made private. I typically uncheck the default checked option. I prefer to let anyone use the machines I create, and right now that just means me.
The next step asks you how much memory to devote to your machine. In my experience, I have given it as much as would have been standard at the time the OS came out. For Win2K, that means 128 MB. For WinXP, that means 256 MB. Of course, the actual amount of memory you can give it is limited only by your own system. There is also one additional consideration. By default, VMware will allow you to allocate its pre-determined percentage of total system memory. You can override that default value from the main screen's menu. If you need to give your machine more than is available right now, go ahead and choose a lesser amount. Then later you can override the default and go back and edit this virtual machine's memory.
Read on the next page: Networking, I/O, Disks and Finalizing the Install
You can save yourself a tremendous amount of headaches if you choose "Use network address translation (NAT)" for this option. I have set it up this way on every machine I've installed it on and, provided the machine had a working network connection beforehand, it will work identically. The access your physical machine already has is automatically extended into the virtual machine.
I/O Adapter Types
I'm not aware of any particular advantage in choosing BusLogic over LSI Logic. I've always used the default option and it's worked just fine. If anyone knows why it might be desirable to choose the non-default option, please post the reason in the comments.
This is where it can get tricky. Generally speaking, it is very easy because you simply want to "Create a new virtual disk". If that's your choice, then proceed. However, there are other options to consider and I'll go over them briefly.
"Use an existing virtual disk" is a way to connect to a previously created disk. This is where the true power of virtualization shines. If you have a disk that you'd previously archived, or copied from someplace else. You can create the virtual machine here, connect to that disk, and then when you power it on for the first time you'll boot right into whatever was already setup on that disk. This could be a full version of the OS with all of your settings. It could be an empty disk. It could be anything. The point is that whatever was already there in that disk, that's what you'll be using. You can think of it as preparing a physical hard drive with an OS install on it just the way you like it. Then, you pull the drive out of the machine and stick it on the shelf. At some point later you come back to that drive and plug it back in. All of your files, just as you left them, are there. You're up and running with only a reboot. Very nice.
"Use a physical disk (for advanced users)" has several options that I'm not going to go into. However, this is a very powerful tool. I'll be going into this somewhat later for adding second hard drives to your machine so you can access a common partition for file sharing between virtual disks. But for now, know that you can setup your virtual machine to physically mount a real hard drive. All file I/O will not be done to a file in that case, it will be done to a physical disk. This has some advantages and some disadvantages. If you want to write to a physical drive, go for it.
Virtual Disk Type
Assuming you chose "Create a new virtual disk", the next screen will ask you the virtual disk type. The options are IDE and SCSI. Generally speaking I have chosen SCSI, which is also the default. However, some operating systems do not recognize SCSI hardware. For those, choose IDE.
Assuming you chose "Create a new virtual disk", the next screen will ask you how big to make the hard drive. In our example we're using 10 GB. You can adjust up/down as necessary for your needs. Remember, we are looking for the required space for the OS + installed applications + data. If you're using a fully encapsulated machine (one that won't connect to external hard drives or virtual disks), go ahead and make it a little bigger (to allow for your data). Fully encapsulated disks have the advantage that they are completely self contained. If a nasty virus kills your system, it will stop with the virtual environment. It won't go any further. However, you will also lose the ability to share files without some type of FTP application, CD-RW or plug-in device like USB / Compact Flash drives.
The option for "Allocate all disk space now" should be checked. This will create the whole virtual disk and it will never have to be resized. If you uncheck this option then file fragmentation later on can cause big slowdowns.
The "Split disk into 2GB files" option can be handy if you need to transfer files via some medium which does not allow the whole drive to be moved at once. I have always unchecked it; that way I have a single file which is the size of the drive (in this case 10 GB). I have not heard of anyone experience performance benefits or limitations choosing either method. If anyone knows of any, please post so in the comments.
The last step is to name the disk file. Again, I suggest shortened names like "Win2Kp.vmdk" for Windows 2000 Professional. The file will be created in the directory specified previously. If you selected the "Split disk into 2 GB files" option then it will create additional files with the "-001", "-002", "-nnn" extensions up to the total size.
Once all of the steps are completed, VMware will go ahead and create the physical disk for you. This will take a while to format and set everything up. Once completed, this part one of two steps to run a virtual machine is completely finished and will never need to be revisited. If you need to change any virtual machine settings, choose "Edit virtual machine settings" from the tab showing the virtual machine's name. If you need to adjust your system's allocated memory for VMware, choose Host - Settings - Memory, and increase the allocated memory as necessary. Then, go back and edit your virtual machine.
My desktop machine has 2 GB of RAM. I typically don't run more than two VM instances on my local machine. I have allocated 512 MB to one and 256 MB to the other. As such, I allocate about 800 MB of RAM to VMware. This leaves a small buffer. You can set it up exactly by creating a value that's too small and then trying to run all of the virtual machines at once. VMware will tell you the minimum amount required for the host to run the virtual machine. This might be worth doing if memory is tight. Note also that you can edit the virtual machine's settings at any time and allocate more or less memory as needed. This only works when the machine is not running.
Sound and other adapters
You may have noticed that the default install did not ask you for other adapters. They can be added by clicking on "Edit virtual machine settings" and from the "Hardware" tab choosing the "+ Add" button. There are several devices which can be added. Follow the on-screen steps to set them up properly. And in case you're wondering, sound works perfectly in the VM versions of Windows I've used. Everything plays properly, including video and audio. I have not done much gaming, so I can't speak to that. I'm sure someone will post comments about that though as gaming is a high priority for many.
VMware has some amazing abilities. You can connect to virtual CD-ROM drives using ISO files from your hard drive. This keeps you from having to physically write a disk for whatever you might need to install. It also installs much faster than the CD does. It's a win-win. The same is true for floppy drives. You can create floppy images and they are much faster.
You can also connect to other virtual hard disks and physical disks from the "+ Add" option under "Edit virtual machine settings". The physical disk option is the one I'll discuss here. I recommend that everyone who's going to use virtualization to partition their hard drive in such a way that they have at least one Ext2 or Ext3 partition, which is of whatever size is required for what you will do. For me, it means having a Linux boot partition which is about 120 GB. This is a physical partition on the drive, and it's the one I installed Ubuntu into. This is where I've created my virtual machines, and I've left enough space for future VMs I might create.
The most important advantage is that this allowed me to use the rest of my hard drive space to create a second partition that is very large. This partition on my drive was about 380 GB and I created it as an NTFS partition (so Windows would work natively). The reason I did this was so that each virtual machine could have a second hard drive added, one that is physically mapped to that partition. By doing this, I automatically create a shared disk which is accessible from everything. When I download files I can store them at a place where all machines can reach them. It also means that I can install files to that location from the OS partition itself, thereby not requiring applications to take up some of the virtual disk's disk space. However, that does limit the machine's ability to be moved from location to location. And such concerns of course must be considered.
Personally, I think it is well worth it. I still install all of my software to the individual virtual machine disks. But, I do all normal downloading and work to the other drive. This setup has afforded me great abilities to move between OSes and not lose any data or content.
Read on the next page: Powering on for the first time
Once your virtual machine is setup it's ready to go. When you click the "Power on this virtual machine" button it will begin with a windowed screen. The windowed screen shows the VMware bootup BIOS working. There are some amazing abilities here as well. VMware has done a truly excellent job in creating a great BIOS. It allows you to boot from a floppy, from the hard drive (virtual or physical), from the CD-ROM, from USB or other bootable device, as well as providing a remote network-based boot ability. If no bootable devices are found on the disk (which will be true the first time you power it on - typically you'd boot from the floppy or CD of the OS you wish to install), then it will begin looking for a DHCP server to initiate a remote boot. If you have the ability to set one up, this is a great feature.
When you fire it up the first time, you will want to make sure you have the OS CD or floppy installed. The BIOS will find it and boot from it automatically. Installing Windows was much faster in VMware than it was on the real machine. I was amazed. The Windows XP install took about 15 minutes. Once it was installed, it only took 7 seconds to boot. Applying Service Pack 2 did slow down the bootup time rather notably. It takes about 13 seconds now. Shutting down takes about 5 seconds.
Once the OS is installed, or even while it's installing, the machine might seem a little clunky. The mouse input and movement will likely be off. This is because the VMware engine has to redirect mouse and keyboard input in a way which emulates hardware functionality.
VMware comes with a built-in set of applications which can be installed inside the OS. These will make the mouse and keyboard run more smoothly. The option to install those services is available from the VM - Install VMware Tools menu. It will simulate inserting a CD into the machine, which will automatically cause the install program to run. Once those tools are installed, the mouse and keyboard will focus into the VM each time they're "over" the machine. Until that is setup, the mouse must be clicked on the window; pressing CTRL+ALT will release the mouse and keyboard.
Examining your virtual machine
Since the new VM user will be migrating from the physical into the virtual, it might be a good idea to poke around the file system and see what is what. Once the OS is installed, additional software is installed, data files are arranged and setup just the way you like it, it might be a good idea to go ahead and make an archive (ZIP file if it's 4 GB or less when ZIP'd, RAR or other form if larger). It will take several minutes to compress a large file like that, maybe even close to an hour. Just remember that you're making a snapshot backup of your complete system. Consider comparing those scores of minutes of compute time to the hassle of making a real system backup. Chances are you will have found a new friend in speedy backup procedures.
Full screen or windowed
Virtual machines can be run in full-screen or windowed mode. Clicking the maximize button on the window will automatically go into full-screen mode. Once there, a type of control panel is at the top. It can be pinned or auto-hidden. In auto-hide mode, it makes the entire OS appear as it normally would. All video modes are supported which the host OS supports. The "Console" button can also be clicked while a machine is running to go back to the VMware edit menus. Not all machine settings can be updated while a machine is running, but some of them can.
I've had some experiences with VMware not releasing CDs when ejected and inserted. This initially caused the system to be unusable whenever any install required more than one CD. However, I found a workaround. If you have any problems on your system with CDs not being ejected and inserted properly in the virtual machine, go to the VM - Removable Devices menu and disconnect your CD-ROM drive. Then, re-connect it. This will fix that annoying quirk and make multi-CD installs work without problems.
For those who like their video displays rotated 90 degrees CW or CCW, there may be some issues. The VMware video driver does not appear to support rotation at this time. Whatever orientation the host exhibits, that will be the orientation for the guest. This has caused me some stress in that I have a 1920 x 1200 monitor that I use in 1200 x 1920 mode (rotated 90 degrees CCW). This affords me nearly perfect read abilities and works quite well for development. However, it limits my ability to have VMs in modes which support tall screens. I would like to have a native 1200 x 1920 mode, but VMware only supports the traditional video modes. The closest I can find that works is the one immediately below 1280 x 1024, and that's just not enough on the screen at the same time. My workaround has been to set a huge video mode of 1920 x 1440 and then run it windowed with half the virtual screen scrolled off the physical screen. I typically then only use the left-half of that virtual window, thereby making everything 1200 x 1440. It's close to 1200 x 1920, but not quite. It too is an annoying quirk.
In the process of experimenting with VMware installs, I kept installing Windows XP Home edition. Each time it would come up I activated the OS following the install. Well, after doing this several times I was finally told by Microsoft that I had activated my copy too many times. As such, I had to phone Microsoft and get a manual key to input. It was annoying, but it worked. So, for anyone installing XP or Vista which requires activation, don't activate it if you know you're going to be trashing it shortly thereafter. You are allowed 30 days for activation. I suggest you use all of those days.
Also, if anyone else has other suggestions to keep these annoying quirks from happening, please post them in the comments.
Virtualization and Gaming
One concern many readers will have is in the area of gaming. I can say truthfully that I am not a gamer and I don't know how well it will perform. I don't even have a modern game I could install to test it. I can report that everything I've done using the Windows GDI works just fine. This includes custom software I've written. In fact, apart from the annoying quirks above I haven't found any issues whatsoever with VMware. It's worked perfectly and flawlessly, even installing service packs and updates without issue.
If you're a gamer and have used VMware for gaming, please post something about your experiences in the comments section.
Read on the next page: Conclusion and opinion
Right now I'm sitting atop one month of Ubuntu Linux use and about one month minus three days of VMware running Windows XP and 2K. In that time I've learned several things about the way a system should be configured. I'm going to give you a brief overview of what I went through and the realization I'm sitting at today.
First, I have a 500 GB hard drive. It is partitioned into several partitions. Right now I'm using an 80 GB Ext3 partition as a data drive. I also have a 20 GB Ext3 partition as my Ubuntu boot drive (host OS). The rest of the hard drive is partitioned into a large NTFS data drive which is shared by Linux and my virtual Windows machines. I'm about to change that.
After having spent this much time running Linux and VMware Windows, I've decided to redo my configuration. I'm going to be getting another 500 GB hard drive for the new setup. I will create a single 150 GB partition to install Ubuntu into. However, this Ubuntu will be nothing more than a minimal Ubuntu with VMware. Then, from inside of VMware I'm going to create my main Ubuntu machine (the one I use every day). I'm going to also use my already created Windows machines.
By moving to this model of me running Ubuntu from inside of Ubuntu, I gain all of the flexibility of my base or home operating system through virtualization. All of the advantages I outline in this three-part article will be had with only one additional layer of virtualization.
For me personally, that what is gained by running virtualized machines outweighs in every conceivable way the small performance loss I might see. In fact, from what I've observed so far running Windows virtualized, the loss is no greater than 10% at most. And for most everything I do, that's not even noticeable. And for everything I gain, I find myself laughing at that insignificant slowdown in much the same way the French taunter might've from Monty Python's The Holy Grail.
Installing VMware is easy. There are several steps to go through, but none of it is complex. The most difficult transition I envision anyone having is moving from their native Windows configuration to a small footprint Linux box running Ubuntu as the host. Once that host is setup, and once VMware Server is installed in the host, the rest of it becomes a piece of cake.
For those with the resources to buy more memory and a new hard drive (and possibly upgrade to a dual-core CPU), I highly suggest doing so. It will make the entire transition much easier and the performance will go up notably. Also, by moving to a new hard drive, utilities like Ghost can be used. This provide the ability to take the physical install on a real hard drive partition and write it directly to a virtual disk. This will keep your current physical hard drive settings and migrate them to the virtual machine.
VMware is a utility that has the potential to become a new best friend of any advanced user. Opportunities arise by having soft machines which are simply not possible without it. Any minor slowdowns seen in performance are more than offset by the flexibility and power gained.
I look forward to reading everyone's comments and suggestions.