Chitika

Thursday, November 11, 2010

How do I add a second drive to a Windows XP virtual machine running in VirtualBox?

Virtual machines are set up to expand to a set size, and once you reach that size you are out of luck – unless you know how to add virtual drives to that machine. In VirtualBox this is quite possible, albeit a bit circuitous. The end results, however, will give you plenty of room to expand the capabilities of a virtual machine.

I will be illustrating this task using VirtualBox on a Linux (Ubuntu 10.10) host and a Windows XP guest. The task with other combinations will vary, but the fundamental idea remains the same.

Step 1: Shut down the virtual machine

Make sure you don’t suspend the machine, because you won’t be able to access the settings.

Step 2: Create a new virtual drive

A couple of steps are required to make this work. The first is to actually walk through the process of creating a new virtual machine. During this process you will define a new drive for that machine. Make sure you make the new drive the size you want for the additional drive. By default you will create a 10GB drive — if that will serve as enough additional space for your second virtual drive, leave it as is. If you need more space, adjust it during the creation of the virtual machine.
Once the new virtual machine is created, you can then go back and delete the new virtual machine. This process will leave behind the newly created drive that you can then use for your original virtual machine.
The next phase of this step is that you need to open the settings of your virtual machine (the one you are adding the drive to) and then go to the Storage section (Figure A). Here you are going to add a new drive to this virtual machine. This new drive will be uninitialized and will have to be initialized later (from within the running Windows virtual machine — more on that in a bit).

Figure A

As you can see, I have already added a new drive for this virtual machine and labeled it D.
To create a new drive, you need to select the main controller for the virtual machine and then click the Add Hard Disk button. When you do, a new disk will appear under the controller. If you select that new disk, you can then change the hard disk from the drop-down menu (Figure B) to the hard disk you just created earlier.

Figure B

When you click the Hard Drive drop-down menu, all the available drives will show up.
Once you have the hard drive chosen, you will need to select it as the Primary Slave (from the Slot dropdown) and then click OK.

Step 3: Initialize the hard drive

Now you need to go ahead and boot your virtual machine. Once that machine is booted and you have logged in, click Start | Run and then enter compmgmt.msc. When this tool starts, click on the Disk Management section under Storage (you may have to expand the tree to view) and then click the disk you want to initialize. When you click the disk to initialize it, the Initialize and Convert Disk Wizard will appear (Figure C). Check the disk to initialize and click Next.

Figure C

You might have more than one drive listed. Make certain you select the correct drive.
The next step is to select the disk you want to convert. Select that disk and click Next. Finally the wizard will give you a report on what it is about to do (Figure D).

Figure D

If all looks well, click Finish and your drive will be initialized.

Step 4: Create the partition

You now have an initialized, unformatted drive. This drive has to be partitioned in order for it to be of use. You should right-click the unallocated space (Figure E) and then select New Partition. This will walk you through the Partition Wizard.

Figure E

The unallocated space will be indicated by the diagonal stripes.
In the next screen (Figure F), you need to add the disk to the selected area.

Figure F

By default, your drive should already be selected. If not, select it and click the Add button.
When your drive has been selected, click the Next button to move on to the next phase of the partitioning. In this phase you will assign the drive a letter and then click Next. On the next window (Figure G), you select if you want to format the drive and, if so, what format you want the drive to be.

Figure G


You can give the drive a label if need be. You can also enable compression and do a quick format instead of a standard format.
After you have this configured, click Next and the formatting will complete. You are almost done with this task.

Step 5: Reboot

In order for this drive to be available to Windows, you have to reboot the virtual machine. Once you have done so, the drive will be available to the system.

No comments:

Post a Comment