Linux Goodies

In Pursuit Of The Perfect O/S



Introduction to using Virtual Machines on a Linux Host

Amazon Computers

Virtual Machines -- What Are They?

If you're an active computer user, by now you may have heard the term Virtual Machine, or VM.

Chances are you already have some idea of what a Virtual Machine is. But in case you don't, this introduction is a layman's view of what a Virtual Machine is, and what it can be used for.

Basically, a Virtual Machine is an elaborate program that provides a virtual environment for code running within it. By virtual environment, I mean that an expected architecture is apparent to operating systems running in the Virtual Machine, even though the various aspects of a real environment, such as interrupts and hardware interfaces, are created by software in the VM, and are not real or direct to the actual architecture.

What Virtual Machines try to do is let an operating system run inside a synthesized environment and apparently see all the aspects of an actual hardware architecture that it seeks, yet all of this is only simulated by the virtual environment.

The Virtual Machine allows controlled access by the enclosed operating system (called the guest) to the actual hardware and other resources in the host system. By controlled access I mean that the host is protected from anything the guest may want to do. The guest, for example, is confined to a provided virtual disk system within the machine, and cannot access the disk space controlled by the host except perhaps by a networking method.

VMs give the multi-boot concept the boot

It's a relatively new concept in that computers of only a few years ago didn't have enough resources to allow such a thing, except for some specific and small cases. The old solution, if one wanted to run more than one operating system on a computer, was to have lots of disk space, and run a multi-boot setup.

That worked well enough, the disk being the only significant additional resource needed. To get from one operating system to another, one would have to exit the current operating system and boot to another. Not exactly convenient, but doable and reliable.

The limited Virtual Machine efforts I spoke of early were things like running MSDOS within Windows, or MSDOS (via dosemu) in an xterm running in Linux, or even running a Windows program using wine on a Linux operating system.

Getting dos to run within Windows and Linux was relatively easy, and light on resources. But going further, like running Linux within Windows or vice versa, had to wait until significant resources other than ample disk space was available.

So how much resource do you need for a VM?

Obviously, in order to have one or more guest operating systems installed on your host, you'll need enough disk space for each system. Modern operating systems easily chew up a few gigabytes in a basic install, and even more if a lot of applications for the guest are used.

The good news is that a couple of hundred gigabytes is becoming a pretty standard amount of disk space on even a modest modern system. That's easily enough room to house a few guest systems, even being generous with the amount of disk given them.

But disk space alone isn't enough. A computer running guest operating systems within a host has to have enough memory to keep them both functioning simultaneously. Trying this with much less than a gigabyte of memory isn't such a great idea. But with a gigabyte or more memory, you can generally run a guest comfortably in a host computer. I commonly run Windows 2000 in my Debian Linux host with a gigabyte of memory.

But even memory isn't totally enough. Since a Virtual Machine is having to synthesize much of its guest environment, there is inevitable slowdown experienced by the guest OS. Again, modern computers are up to the task, and some VMs run much faster than others. I am able to run Windows 2000 comfortably on my 1 gigahertz computer in some VMs, but very sluggishly in others.

Here's what I'm running, and I can successfully run Windows 2000 and Windows XP within my Debian system:

  • 1 gigahertz AMD processor

  • 1 gigabyte of memory

  • 80 gigabytes of disk

  • What more could I use?

    If I want to add more than the couple of VM installs I normally use, I'll need more disk.

    If I should want to run Vista, I'd need more memory.

    A faster processor would always be nice, but I'm in the ballpark for reasonable performance.

    So what do you do with a Virtual Machine?

    Today's Virtual Machines can offer many benefits to users, depending upon their needs:

  • Allow a user access to favorite programs on another operating system.

  • Allow a user to investigate other operating systems without harming his or her host installation.

  • Provide a very handy environment for a software developer who does development on multiple operating systems.

  • So how does it work?

    I certainly haven't worked with all the different Virtual Machines out there. But I have worked with three of the most common ones: Vmware server, Virtualbox, and qemu.

    These there machines aren't identical in all respects, but they do share similar guest OS installation techniques.

    Once a Virtual Machine of your choice is installed on your computer, installing a guest OS is much like installing on a native machine environment.

    Each of the VMs I tested started by creating a VM file that was to become the root disk drive for the guest OS. Some of the machines can allow this file to grow as needed, others are fixed (though one can create and mount another VM file as another disk).

    Each of the VMs I tested have a way of indicating what the boot device is, usually a cdrom during the guest install.

    Once an install cdrom for the guest system is booted, installation proceeds much as with a native machine install.

    On the next boot, vmware and virtualbox assume the boot device is the install disk, but qemu has to be told not to re-boot from the cdrom.

    Once re-booted to a newly installed Windows guest, both vmware and virtualbox have some proprietary augmentations that can be installed in the guest to improve performance and add features.

    All of the systems I've tested provide easy to configure network connections to a guest OS. All of them also provide support for USB devices, and serial and parallel port connectivity. So as you can see, you should be able to install an OS as a guest have nearly all of the features working that the guest could provide in a native environment.

    The only feature I'm aware of that's missing on all of them is 3D graphic support. So don't plan to install a guest to be used primarily for gaming.