Wednesday, July 23, 2008

VirtualBox

VirtualBox is an x86 virtualization package originally created by Innotek, and now being developed by Sun Microsystems.

VirtualBox helps us to load and run an operating system on an existing operating system. The operating system on which VirtualBox is installed is called the host OS, and the OS running on the host with the help of VirtualBox is called the guest.

For example, consider a machine with the Windows XP operating system loaded on it, VirtualBox can be installed on this, and another OS, such as Fedora or Solaris can be loaded via the VirtualBox. Here Windows XP is the host OS and the other OS (Fedora, Solaris) becomes the guest.

A free copy of VirtualBox can be downloaded from here.

Further VirtualBox manages the guest OS on the host OS using the concept of a Virtual Machine. Well here comes the tricky part, any OS requires primarily three things.

  • A Processor to run the various tasks
  • A memory unit, commonly known as the RAM
  • Some storage space, basically available on the hard disk

Whenever a guest OS is installed on a host, the VirtualBox takes care that the guest receives these three resources whenever the OS runs.

VirtualBox manages the processor, without any user-interference, however coming to the RAM and the Storage Space, user discretion is required, as we will be seeing a little latter.

Steps for starting up a virtual OS

Create a new VM using Machine->New or the New icon available on the screen.

Follow the wizard, which will be first asking for the name and type of the OS being installed, this will entirely depend on guest OS which you will be installing.

Next the amount of RAM to be reserved for the operating system will be asked, this will depend on your machine and how much you would like to spare.

Remember! The RAM which is reserved here will not be available to the host, when the guest is running. That is if you reserve 512 MB from a 2 GB RAM, the available RAM to the host will be only 1.5 GB as long as the guest is running, however this will be returned once the guest is closed.

Caution!!! Your host will also be requiring memory while the guest is running, never lower the RAM for the host significantly, this will lead to insufficient memory for the host, and as a result it might lead to errors.

Now comes the best part that VirtualBox has to offer. It allows us to create a virtual hard-disk, more specifically reserve some space on our hard-disk for the guest OS. Here an *.vdi image will be created at the specified place.

Here an existing *.vdi can be mounted by clicking the Existing button and then adding it to the list via the Add button and then Select it.

Or a new *.vdi image can be created by clicking the New button. The wizard will ask you whether a static image or a dynamic image is to be created. A static image is one where the entire memory is allocated at one go, whereas on the other a dynamic image is one where a maximum amount is specified, but the size increases as the data is added onto the guest OS. For example consider 25 GB is allocated for the guest. In static the entire 25 GB will be a single *.vdi image, where as in dynamic the basic installation will take some space, and latter as files are added the size will increase.

And don’t forget to mention where you want the image to be, otherwise it will written onto a default directory. Here dynamic memory occupies only required amount of space, and is beneficial if you a normal user and if you are not sure how much you will using, as the host will lose the space which is not being used by the guest if created statically.

Once you finish this you will taken back with the new hard-disk selected. Finally click Finish, and you will be able to see your image on the left-hand side of the screen. Now right-click the image on the left and select Start, or left-click and click the Start button.

Next it will ask you for the media type, where you can you either give an *.iso image or a CD/DVD/Floppy to load from. And then continue the regular process of installing the Operating System.

Once the installation is completed, you can turn on the guest OS by starting it as told above, and shut it down normally as done in that OS.

Important Tips after Installation

Once the VM is setup, the RAM occupied can be changed by right-clicking the image on the left hand side, and selecting Settings and changing the RAM accordingly. You can change the focus of the mouse and the sensitivity of the keyboard from the guest to the host by using the right-ctrl key.

The next important thing is to establish a connection between the guest and the host. This is done primarily by creating a shared folder. Before we create a shared folder, certain software called the VBoxGuestAdditions is to be installed. This is done by starting the OS, Devices->Mount CD/DVD-ROM and select VBoxGuestAdditions from the drop down menu, it is present there by default, otherwise search for it on your host. Immediately you will a CD available on your guest and install the appropriate executable for your guest. Next go to Devices->Shared Folder, add the folder to be shared between the guest and host to the machine folders. Then click Ok. That’s it, a shared folder is created. Search for it on your guest and you will find it in no time. For Example a shared folder in a UNIX type OS will be available in /mnt of the root. However this might vary from guest to guest.

Another way of achieving connectivity is via a pen drive. Once the pen drive is connected it will be automatically detected by the host. To gain access of the USB drive from the host, firstly go to the Settings menu of your guest OS. There from the USB tab Enable USB Controller. Now filters may be added for easy recognition of the USB drive. Now start the VM. From the Devices->USB menu, select the required USB drive, the required drivers will be installed on the host the first time it is done, and the USB drive will be available on the guest after some time. The USB drive may be removed from the guest by going back to Devices->USB and deselecting the USB.

I think these points are sufficient for a beginner to VirtualBox, however more advanced features can be easily explored by putting in a little effort.

No comments: