Random Thoughts

Views on life

Adding an additional hard disk in VirtualBox

Posted by Hemanta Banerjee on October 30, 2010

I came across this great appliance (http://www.oracle.com/technetwork/database/enterprise-edition/databaseappdev-vm-161299.html) from Oracle with all the basic oracle software such as the database and other developer tools already pre-installed. After importing the appliance I found that as usual it did not have enough disk space for me to play around. So the challenge for me was how to expand the disk space so that I could install all the Oracle middleware products such as Weblogic server and fusion middleware so that I could test out some of the new features in 11g OFM.

For those who do not know about VirtualBox, I would definitely recommend that you check out www.virtualbox.org. VirtualBox is a x86 and AMD64/Intel64 virtualization product very similar to VMWare. It is very feature rich and is the only solution that is freely available as Open Source Software. This was developed by Sun but has been embraced by Oracle as well.

The virtual box provided by Oracle had Oracle Enterprise Linux as the guest OS. Being a linux newbie searching google for steps to expand was frustrating to say the least. So I ended up adding a new hard disk that I plan to use for my new installations.

First add a new hard disk. Go to the virtual media manager as shown below and add a new disk.


In my case I added the disk with expandable storage so that I do not take up the space on my host machine. This will have some impact when I start adding adding data, but since I am using this for testing purposes only that should be fine.


Now we need to go ahead and add this disk to the virtual machine. Follow the steps below. Click on Settings and navigate to the Storage section and add the new hard disk as shown below. This will be added as a secondary slave.


Now after booting your guest you need to do some linux magic for the OS to recognize the hard disk. The 1st step is to determine the device name of the newly created disk. Run the command fdisk –l as the root and you should get an output that looks something like this

[root@localhost ~]# fdisk -l

Disk /dev/hda: 12.8 GB, 12884901888 bytes
255 heads, 63 sectors/track, 1566 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot      Start         End      Blocks   Id  System
/dev/hda1   *           1        1350    10843843+  83  Linux
/dev/hda2            1351        1566     1735020   82  Linux swap / Solaris

Disk /dev/hdb: 12.8 GB, 12884901888 bytes
255 heads, 63 sectors/track, 1566 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot      Start         End      Blocks   Id  System
/dev/hdb1   *           1        1566    12578863+  83  Linux

Disk /dev/hdd: 32.2 GB, 32212254720 bytes
16 heads, 63 sectors/track, 62415 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes

Disk /dev/hdd doesn’t contain a valid partition table

/dev/hdd is the newly added disk. I am sure there is a better way to find this information but this worked for me. Now format the disk with the command. I can create a new extended partition by using the fdisk command. I create 1 extended partition for the entire disk. Now format the disk using the mkfs command as shown below.

mkfs -t ext3 /dev/hdd

This disk is now ready to be used. In my case I want to mount the new disk as /apps where I am going to install all the apps. So I need to create a new folder /apps and make the entries in my /etc/fstab


Now reboot and your disk is ready for use.

3 Responses to “Adding an additional hard disk in VirtualBox”

  1. […] my oracle software is seperate  from my root system. I combined information from two articles: the first on adding an additional disk on virtualbox. The first article missed some vital information on […]

  2. […] Adding an additional hard disk in VirtualBox […]

  3. Thanks, it’s very nice.
    However, when I tried this, it’s giving me a new disk with 0 cylinders and therefore, I can’t add my own partitions there.

    I used fdisk -l.

    Do you know how to fix that?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

Join 206 other followers

%d bloggers like this: