How to add hard disks in VirtualBox - Tutorial


Updated: November 7, 2009

In the last article on VirtualBox management, we learned how to clone virtual disks using the VBoxManage utility, which allowed us to easily and reliably replicate our setup for mass deployment in a large environment.

Today, we will learn how to extend the flexibility of individual setups by adding hard disks into existing and running virtual machines. This is identical to adding hard disks to a physical machine and can be used for a variety of reasons: more data storage, better performance or increased reliability via RAID setup and others. Let's see how this is done.

Virtual machine settings

When you create a virtual machine in VirtualBox, all its settings can be seen and edited via the Settings button in the main menu. Click on the button for any virtual machine and start changing the parameters to suit your needs.

You may want to do something as simple as disable the floppy drive or increase RAM size. In our case, we want to add a second hard disk to our machine. Under Settings, go to Hard Disks sub-menu. In the right pane, you will see the list of all available and attached disks, including their size and the controller type.

Different operating systems will require different controller types. Still, this is an advanced option and should not bother you too much at this point. If you're unsure, just let VirtualBox manage the recommended controller types for you. For now, we have a single disk available. We want to add a second. Click on the icon to the right displaying a stack of disks with a plus sign above it.

Add disk

VirtualBox will automatically select the first (alphabetically) of all disks available. In our case, it preselected the Fedora disk, which is not what we want. We would like to add the cloned disk from the last time as our second storage device.

Wrong selected

Click on the Folder icon to the right (with the little green chevron) to expand the Virtual Media Manager. This utility lists and manages all storage media that VirtualBox sees. Our cloned disk (aptly named cloned-hd.vdi) is not in the list. We need to Add it.

Manage

After clicking Add, navigate to the folder where you expected to find cloned-hd.vdi. This can be another internal hard disk, an external device, even a network share. I've successfully mapped virtual hard disks from all these locations.

Selected disk

Once satisfied, click Select. Now, OK the change. You're good to go. In fact, you can even try something as wild as changing the boot order of the two devices. Switch between them. This is also an excellent opportunity to test our cloned image.

Change order

And here we go:

Booted

Conclusion

VirtualBox has a very simple way of managing storage devices. It's point and click really. Of course, all these tasks can be automated via the command line, if you require the disk management to be scripted and scheduled.

The one downside is that you have to take your guests offline, as you cannot hotplug additional storage. But with the small inconvenience of a downtime, you do have enormous flexibility in your setup. Even if you've made a wrong initial choice to the space demands of your guest machines, you can always add new disks later. Hopefully, this tutorial clearly and simply showed you how to do that. In the next article, we will discuss disk shrinking and expansion. In the fourth part, we will talk about network setups and sharing.

Dedoimedo out.

RSS Feed icon

del.icio.us del.icio.us stumbleupon stumble digg digg reddit reddit slashdot slashdot



Advertise!

Would you like to advertise your product/site on Dedoimedo?

Read more

Donate to Dedoimedo!

Do you want to
help me take early retirement? How about donating
some dinero to
Dedoimedo?

Read more

Donate