When you first create a virtual machine in your Virtualbox, it will always prompt you to create a new virtual hard disk. While creating the hard disk, most people will opt for the default storage space (20GB). However, if you are using it as frequent as me, you will find that the 20GB of storage space get filled up very quickly. If you are looking to increase the virtual hard disk size, here is how you can do it.
If you are using a Linux host, open the terminal. For WIndows, open the command prompt. Type the following:
The “x” in the command is the amount of space (in megabyte) that you want to resize to. For example, if you want to resize from 20GB to 30GB, the command is:
Press Enter. You should see the progress bar. When it reaches 100%, the resizing process is completed.
The next step is to get the respective OS to recognize the increase in storage space.
For Windows Guest
In your Virtualbox screen, you should be able to see that the virtual size has increased, but when you run the OS, it will still show the old partition size.
In your Windows OS, Click on Start and type “partition” in the search bar. In Windows 8, you can perform a search using the “Search” icon in the sidebar, but you will need to select the “Settings” option.
Select the “Create and format hard disk partitions” option.
In the screen that show up, you should see a new blank unallocated partition at the right of the active partition.
Right click on the active partition and select “Extend Volume”.
That’s it. In your Windows Explorer, you should be able to verify that the hard drive has increased in size.
For Linux Guest
Depending on your hard drive setup, it can be a difficult (or easy) task to extend the active partition. If all you want is to add extra space to store your files, it is easier to format the newly created space and access it as an external partition in Ubuntu.
Start the Linux VM. Install Partition Editor app.
Run GParted. You should see an unallocated partition. Right click on the unallocated partition and select “New”.
For the file system, I chose “FAT32” since it is well supported by both Linux and Windows. You can also choose ext2/3/4. Click Ok.
Click the “Tick” button at the top to apply the changes.
Once that is done, you can open your file manager and mount the newly created partition.
That’s it. You can make use of the external partition to store your things now.
If you are looking to shrink your VM instead, here is the tutorial.