How to Use VirtualBox: Test Environment
    Main Page
    Lab Hardware
    Lab Software
 

Last updated: 29 Apr 2011

Test Environment With Full Control

Finding the Windows XP Virtual Disk

In DOU101 and the GenDev Labs, there is a VM with Windows XP SP3 called:

"C:\vms\win_xp_pro_sp3_yyyymmdd.vdi"

where yyyymmdd is a date where yyyy is the year, mm is the month number (e.g., 01, 02, etc.), and dd is the day number (e.g., 09, 14). Usually, this is the date (e.g., 20101221 is 21 Dec 2010) when the last updates were applied to the guest OS.

Starting VB

First we define folders on the local hard drive to store most of our VM information, then we start VirtualBox to change its default locations to our predefined folders, and then we add a virtual disk in a way that makes it immutable.

  1. Make a directory for your use in C:\temp and allow only your account to use it

    In a command shell, enter:

      mkdir C:\temp\%username%
      cacls C:\temp\%username% /e /r Users
      
  2. Start VirtualBox

    Icons to start it are usually in a desktop or start menu folder called "xxx Lab", where xxx is GenDev, ADC, etc., under the "Oracle VM VirtualBox" subfolder.

  3. Select menu item File/Preferences
  4. In the General/Default Hard Disk Folder text box, enter: C:\temp\uwnetid\hd

    Substitute your UW Net Id for uwnetid.

    The changes to the VM's disk will be placed in the C:\temp\uwnetid\hd folder. We don't use H:\ for this because home directories may not have enough space and they are on the network -- a virtual machine can perform a lot of I/O on the network, which we are trying to avoid to maintain good performance.

  5. In the General/Default Machine Folder text box, enter: C:\temp\uwnetid\vm

    Substitute your UW Net Id for uwnetid.

    The changes to the VM will be placed in the C:\temp\uwnetid\vm folder.

  6. Click OK to accept the default folder changes.
  7. In a command shell, enter:
      VBoxManage openmedium disk C:\vms\win_xp_pro_sp3_20101221.vdi --type immutable
      

    This will create a reference to the virtual disk that contains Windows XP as an immutable disk. While immutable disks by definition cannot be changed, shortly we will be telling VirtualBox to keep any changes written as a set of differences to that immutable disk. Those changes will be saved in a subfolder of C:\temp\uwnetid\vm.

Creating a VM in Which to Run Windows XP

When we create a VM, we are allocating resources from the host computer that the virtual machine can use to simulate a real computer. First, we identify the virtual machine name and what OS it will be running (helps VirtualBox to run better), then we define the amount of RAM it will be allocated and the disk it will use. That information is the minimum amount that VirtualBox needs to define a virtual machine so it will work when you start the virtual machine.

Unless you want multiple copies of the same VM, you only need to create a VM once.

Create a new virtual machine from VirtualBox:

  1. Click the New button
  2. Click the Next button
  3. In the "VM Name and OS Type" panel, enter for the Name: Windows XP

    Make sure that the "OS Type: drop down boxes below it read "Microsoft Windows" for the operating system, and "Windows XP" for the version.

  4. Click the Next button
  5. In the "Memory" panel, in the box to the left of the MB text box, enter: 512

    We don't normally need a lot of virtual RAM; 512 MB is usually enough. Also, we don't want to reserve a lot of RAM for the VM because it takes away from the available RAM that the host can use; we want to conserve resources to keep the host and the guest performing well.

  6. Click the Next button
  7. In the "Virtual Hard Disk" panel, select the radio button before Use existing hard disk
  8. If the immutable disk for Windows XP does not appear as the chosen disk in the drop-down box, use the drop-down box to select it.
  9. Click the Next button
  10. Click the Finish button to create the VM.

Because we are re-using an immutable disk (i.e., other people can use the same virtual disk because no one can change it), we must allow our changes to it to be saved. We do this by taking an initial snapshot in VirtualBox while the VM is running. It only needs to be done once per VM (unless you delete the snapshots):

  1. Click on the Windows XP VM to make sure it is the one selected.
  2. Click the Start button
  3. As soon as you see the VM start, press F12 to stop the booting.
  4. Switch to VirtualBox's window and click the Snapshots tab
  5. Click the camera icon to start taking a snapshot
  6. Click OK to accept the default snapshot name
  7. Switch back to the VM window, press the rightmost Ctrl key to release the cursor, and power off the VM (close the VM window).

Now the VM should be configured to just record the changes you make to Windows XP. The data will be saved in C:\temp\uwnetid\vm\Windows XP\Snapshots.

Starting and Using the VM

While there are several ways to start (and later stop or pause) the VM, we will show you the one that uses VirtualBox's GUI.

  1. Click on the Windows XP VM to make sure it is the one selected.
  2. Click the Start button

    You should eventually see a the guest OS's (e.g., Windows XP) login screen. The login name is either itadmin for administrator access (only provided if needed), and ituser for unprivileged access. The appropriate password should be provided to you by the instructor.

    Because the VM is on the network, it is a good idea to change the password to something only you know; otherwise, other students may be able to remotely use the VM whenever it is powered on.

Stopping a VM

You MUST stop your virtual machine when your class or lab session is over. A running VM will interfere with the next person's use of the real computer, which probably won't involve your VM.

To make sure the guest OS is in a good state for the next time you run it, you should explicitly shut down the OS using the its command or interface. If you can't do an orderly shutdown, then use VirtualBox to power off the VM -- at least that saves resources on the real computer.

Troubleshooting Problems

Not Enough Disk Space

  • Not enough space on host machine

    The disk on some host machines is too small to handle the space needs of the OS, all of the other applications, and the VM. This space cannot be extended.

    However, you might be able to use a large external USB disk drive. Your virtual machine should be powered off.

    1. Copy the contents of C:\temp\uwnetid to your USB drive.
    2. In VirtualBox's GUI, change the preferences to point to your USB drive via selecting File/Preferences..., then changing the General Default Hard Disk Folder and Default Machine Folder to their new locations on your USB drive.
  • Not enough space in virtual machine

    Inside a VM, you only have the amount of virtual disk space that was allocated at the time the VM was created. With the VM powered off, using the Virtual Media Manager (File/Virtual Media Manager...), make another virtual disk somewhere on the host or an external USB drive, and connect the new storage to your VM. The details are left to the reader.

Using DVDs

If the real machine does not have a DVD drive, if there is enough space, you can put an .iso image on the hard drive and then change the CD/DVD drive of the VM to use it. Use the Virtual Media Manager (File/Virtual Media Manager...) to associate it with your VM, then connect the virtual disc to your VM.

If there isn't enough space and you have a USB disk drive with enough space, use the instructions above.

Change Log

29 Apr 2011 Original document


Hours  |  Support Information  |  News  | 
Policies  |  Emergencies