Increasing your Virtual Machine Hard-disk allocation From the Host

Increasing your Virtual Machine Hard-disk allocation From the Host

Hello, there and welcome.

In this article, I would be describing the step by step process to increasing the hard-disk allocation of your Virtual Machines (Oracle virtual box) from the host. But first, what is a Virtual Machine?

What is a Virtual Machine?

A virtual machine (VM) is a virtual environment that functions as a virtual computer system with its own CPU, memory, network interface, and storage, created on a physical hardware system (located off- or on-premises) - redhat.com

What this means simply is, you can run another computer system on your computer system. You can have a window running Os on your host while running a Linux Os flavor (there's lots of variety available to choose from) on your Virtual environment, or you could decide to run different window versions on your system, Interesting?

Perks of using a VM

  • The ability to run multiple OS on a single computer.
  • Saves physical Space, Time and Cost
  • Improved Security and Privacy

Installing a virtual machine

The Odin project has a detailed guide to installing a virtual machine here.

My VM is up and ready with Ubuntu as I followed through The Odin Project installation guide, following their recommendation i allocated 20GB of storage to my VM and everything was running fine. As a dedicated learner, I went extra miles studying and creating side projects and in no time I found my VM running out of space, what should I do? Google search? Yeah, and all I came across were lots and lots of commands to increase the allocated hard-disk space and as a beginner, it gets confusing .

Should I just create a new virtual environment?

You don't have to!

Increasing the hard-disk allocation

creating a backup

First, you need to backup your Virtual machine as you might loose your files if you did something wrong, but not to worry too much.

Before 1.png

Turn off your VM , then click on "New" to create a new environment

Before 2.png

Input a name for your environment, type and version then click "next"

Before 3.png

Choose the memory size, then click "next"

Before 4.png

Then select "use and existing virtual hard disk file" as we are only backing up our files, click "create" and you're done with backing up your file.

increasing the hard disk

Step 1.png

Navigate to file and then to "Virtual medial manager", then click

Step 2.png

Increase your disk space with the slider and click on save and your Vm hard-disk has been increased.

But that's not the end, clicking on your Virtual machine > Settings > Storage, you would notice your Vm now has the new allocated space. Starting your VM > Files properties you would see your Filestore doesn't have the new spaces allocated.

final steps

  • Launch your VM environment
  • Open up your terminal or pressCTRL + ALT + T to open your terminal
  • Install gparted using sudo apt-get install gparted
  • Press sudo gparted to launch gparted

No 1.png

Input your password

No 2.png

Right click on the disk and use the slider to add the unallocated space to your Filestore (your screen would be different as I already added the unallocated space to my Filestore)

No 3.png

Resize and save.

No 4.png

Repeat the last two processes for other partitions too and now you have a singe hard-disk space.

Conclusion

Increasing your hard-disk allocation to your guest OS shouldn't be hard and you don't have to go through copying and pasting commands to get it done. In this article, I've highlighted the "clicks" to follow and I hope you find it useful.

See ya!