My Blog

Adding VirtualBox 5.1.4 Hard Disk

by Chris Carlsen-Jones on 10th February 2017 No comments

I recently ran out of space on my VirtualBox VM and found that it’s difficult to increase the size of your HDD. One option is to simply add another disk.

I am working with 5.1.4 VirtaulBox VM running under Linux R7U2. If you’d like to see how the VM was created there are other blogs about this: Installing VirtualBox 5.1.4 and Creating a Linux 7 VM.

If you’d rather increase the size of an existing vdi file, you will need to use a Partition Editor. There is another blog about this here.

So, to add another HDD, Start the VirtualBox Manager, select the VM, click on Settings, then select Storage,.then right click on the SATA controller and select the Add Hard Disk option.

1

2

Use the ‘Create New Disk’ option to create a new vdi file.

3

4

Choose the Dynamically Allocated option.

 

5

Enter a name for the disk and choose the size, then press Create.

Now start the VM and login as root. Open a Terminal window and enter:

fdisk -l

6

Here we can see the new disk: /dev/sdb 42,9 GB

Firstly, we’ll create a partition.

fdisk /dev/sdb

7

Enter ‘p’ to see information about the disk.

8

To create a new partition, issue the command “n” and then select “p” for primary and 1-4 depending on which partition on the drive this is (first, second, third, or fourth), and the size: 42949672960 bytes / 83886080 sectors.

9

Left the last sector as the default (83886079) for a 40GB partition.

Then enter ‘w’ to save and exit fdisk.

Now we can use the mkfs command to create a file system on the new disk.

mkfs.ext3 /dev/sdb1                             (Where sdb1 is Partition 1)

10

Next, create a mount point and mount the disk.

mkdir /u01

mount /dev/sdb1 /u01

11

Then edit the /etc/fstab file so the disk mounts when the VM starts.

Add the device mountpoint fstype options dump   fsck

/dev/sdb1   /u01   ext3   defaults   0   0

12

Save the file then shutdown and restart the VM.

The df -h command shows the /u01 directory:

13

So now we have another 40GB of disk space.

 

Chris Carlsen-JonesAdding VirtualBox 5.1.4 Hard Disk

Related Posts

Take a look at these posts

Join the conversation