Add hardisk to Oracle VirtualBox

I keep forgetting these steps so I decided to document them. Steps to add a extra hard disk space in Oracel virtual box. This is for Ubuntu

1. Add a hardisk using the option from virtual machine settings as shown

add_disk

2. Start the virtual machine. Once the machine is up run the command to get the mname of the driver

sudo fdisk -l

In my case it is /dev/sdc

3. Partition the disk using the command

sudo fdisk /dev/sdc

Then use the command “n” to add a partition and “p” for primary partition. Use the default values (if you have no idea of what they are) and finally use “w” to write the partition table to the disk.

"The partition table has been altered!" 

message indicates partition is successful

4. Format the disk into the filesystem of your choice. I am using ext4 so the coomand is

sudo mkfs -t ext4 /dev/sdc1

5. Creating a mount point. I mount the disk at the location /media/etc_drive_2/ so I create a drive using the command

sudo mkdir /media/etc_drive_2/

6. For auto mount at every startup edit fstab

gksu gedit /etc/fstab

And add the following line

/dev/sdc1    /media/etc_drive_2  ext4    defaults     0        2

The name of the driver and folder name changes based on your system

7. Access permission. I have set the access permission for my login. To do so first mount the drive using the command

sudo mount /dev/sdc1 /media/etc_drive_2

And set access permission using

sudo chown -R USERNAME:USERNAME /media/etc_drive_2

replace USERNAME with correct username

For detailed reading and much more fun visit https://help.ubuntu.com/community/InstallingANewHardDrive

Advertisements

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