Make those VirtualBox virtual disks larger without loosing data

If you have ever used virtualization software to make virtual machines (VMs) then you know how easy it is to add and remove hardware resources to modify the VM to be configured the way you want it to be. Even though you can do far more things hardware wise to a VM than you can to a physical computer (without actually adding more physical hardware) there are still some limitations and things to look out for.

VirtualBox is a virtualization platform designed by Oracle and is free alterative to VMware's vSphere and Microsoft’s Hyper-V software. It allows you to create virtual machines that run on your local computer and use your computer's hardware resources as its own. One catch is that you have to share things like your hard disk space and RAM with all the VMs you make so if you are running 3 VMs with 6GB of RAM each then that's 18GB out of your total RAM that will be used by them assuming you have that much in your computer to begin with.

So let's say you have your VM created and exactly the way you want it except for you realized you didn’t make the hard drive big enough and you already used all the available space to make a volume in Windows. So what do you do? Unfortunately it's not as easy as going into the setting for the VM and simply making it bigger. But that doesn't mean it's not possible but rather that you have to put a little more work into resizing the drive.

As you can see for the settings of a VM named Windows7 there is a virtual disk called Windows7.vdi and its 25GB in size and set to dynamically allocate storage which means grow the disk file as needed. Now we are going to expand the size of the disk to 30GB. You should always backup your data before doing something like this in case something goes wrong.

VirtualBox disk properties

To do this we need to open a command prompt and go to the VirtualBox installation directory after shutting down the VM in question which should be C:\Program Files\Oracle\VirtualBox.

VirtualBox installation directory

Next we need to use the VBoxManage modifyhd command to resize a disk named Windows7.vdi located on our D drive under D:\VirtualDisks. By default your virtual disks will be located at C:\Users\username\VirtualBox VMs but not in our case. So the command we need to run will be

VBoxManage modifyhd "D:\VirtualDisks\Windows7.vdi" --resize 30720

Notice the quotes around the path and the 2 dashes before the word resize. 30720 is 30GB in MB.

Here is the output of our command.

VirtualBox disk resize

Now when we go to the properties of the VM and look at the size of the Windows7.vdi disk it's now 30GB.

VirtualBox disk properties

Then we can go into Windows and extend the volume and that can be done with Disk Management. Simply select the original volume and right click on it and choose Extend Volume. Then allocate the rest of the space to the volume.

DiskManagement extend volume

So as you can see it's not too difficult to enlarge the size of a virtual disk in VirtualBox and it really just takes one command to do so. So next time you are sizing a disk for a new VM you don't have to worry about not making it large enough because you now know how to make it bigger if needed!

Pin It

Join Us On FaceBook

We Recommend:



Join Us On Twitter

Get insights into the computer industry and regular updates on our site. Click Here

OCT Youtube Channel

New tech tip videos posted on a regular basis. Subscribe today! Click Here

Sponsored

LATEST VIDEOS

Use a Static IP Address on an Azure Virtual Machine A...

Create a Virtual Machine in Microsoft Hyper-V If you ...

Enable the Copy and Paste Functionality in your VirtualB...

Microsoft uses default open and save options for its ...

Easily Change you Computer's MAC Address Every device...

Windows has had built in...

RECENT TIPS

Use a Static IP Address on an Azure Virtual Machine A...

Create a Virtual Machine in Microsoft Hyper-V If you ...

Protect Your Computer From Viruses With Avast Free Anti...

Enable the Copy and Paste Functionality in your VirtualB...

Is Fiber Optic Cabling Right For Your Network? In the w...

Microsoft uses default open and save options for its ...

NEWS

Will Net Neutrality Save or Destroy the Internet? Back ...

Who Will be the Future King of the Processor? When it c...

Microsoft Holds off on its Next Windows 10 Update Thanks...

YouTube taking money away from the little guys I’m sure...

Should you be concerned about the Spectre & Meltdown pat...

Microsoft wants us to stop using passwords but they aren...