Photo by 铮 夏 on Unsplash

How to increase the disk/storage size of VirturalBox VM on MacOS

VirtualBox is a free and open-source hosted hypervisor for x86 virtualization, developed by Oracle Corporation. I used it for running a VM of Windows on my MacOS. But Windows kept eating disk spaces and 50GB becomes inadequate recently.

Backup the VM files — Important!

First, backup the VM files before any changes. It’s easy to backup by duplicating the folder of the VM files.

Retrieve the virtual disk location

Here is the file location of the virtual disk which is used in the next step:

Run VBoxManage command to increase the size

Now, open a terminal window and check the current disk info:

$ VBoxManage showhdinfo "/Users/rocky.chen/VirtualBox VMs/Windows10/Windows10.vhd"UUID:           xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Parent UUID: base
State: created
Type: normal (base)
Location: /Users/rocky.chen/VirtualBox VMs/Windows10/Windows10.vhd
Storage format: VHD
Format variant: dynamic default
Capacity: 51200 MBytes
Size on disk: 44444 MBytes
Encryption: disabled
In use by VMs: Windows10 (UUID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)
$ VBoxManage modifyhd --resize 81920 "/Users/rocky.chen/VirtualBox VMs/Windows10/Windows10.vhd"0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
$ VBoxManage showhdinfo "/Users/rocky.chen/VirtualBox VMs/Windows10/Windows10.vhd"UUID:           xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Parent UUID: base
State: created
Type: normal (base)
Location: /Users/rocky.chen/VirtualBox VMs/Windows10/Windows10.vhd
Storage format: VHD
Format variant: dynamic default
Capacity: 81920 MBytes
Size on disk: 44446 MBytes
Encryption: disabled
In use by VMs: Windows10 (UUID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)

Launch VirtualBox

After launching VirtualBox, let’s check the size of disk again:

Re-Allocate Disk Partition with GParted

GParted (GNOME Partition Editor) is a tool for creating, reorganizing, and deleting disk partitions. It could be downloaded here.

Attach GParted ISO file to the VM

After downloading the GParted ISO file, attach it to the VirtualBox VM:

Launch the VM with GParted ISO

Launch the VM with the GParted ISO and select the default settings:

Resize the disk

Right click the /dev/sda3 and select Resize/Move option.

Launch the VM

Before launching the VM, just remove the ISO file from the VM settings.

Cloud-native Developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store