Loading…

CVE Watch
Cybersecuritylinux4 min read

Expand the disk space of a VirtualBox virtual machine - complete guide

MB
Massioudath Bankole
15 May 2026 · 396 views

When your VM displays "Low Disk Space", it is possible to increase the size of the virtual disk without recreating the machine. The operation is done in two phases: enlarge the disk on the host side with VBoxManage, then extend the partition on the guest side with GParted.

Prerequisites:

  • VirtualBox installed on Windows
  • Virtual machine turned off (not paused)
  • Free space available on the host disk
  • GParted Live ISO downloadable from https://gparted.org

Step 1: Locate the VDI file

Open PowerShell and navigate to your VMs folder:

PS C:\Windows\system32> cd..
PS C:\Windows> cd..
PS C:\> cd '.\Users\<USER>\VirtualBox VMs\'
PS C:\Users\<USER>\VirtualBox VMs> ls

    Directory: C:\Users\<USER>\VirtualBox VMs

LastWriteTime Length Name mode
---- ------------- ------ ----
d----- 11/14/2025 4:31 p.m. amazon
d----- 09/10/2025 12:26 amazon2
d----- 09/10/2025 09:10 DNSLABS

Find the name of your VM then list its contents:

PS C:\Users\<USER>\VirtualBox VMs> Get-ChildItem "C:\Users\<USER>\VirtualBox VMs\<VM_Name>"

    Directory: C:\Users\<USER>\VirtualBox VMs\<VM_Name>

LastWriteTime Length Name mode
---- ------------- ------ ----
d----- 11/14/2025 4:21 p.m. Logs
d----- 04/10/2025 15:56 Snapshots
-a---- 14/11/2025 16:31 6310 <VM_Name>.vbox
-a---- 14/11/2025 16:27 7323 <VM_Name>.vbox-prev
-a---- 14/11/2025 16:31 21149777920 <VM_Name>.vdi

Note the exact name of the .vdi file.


Step 2: Enlarge VDI disk with VBoxManage

The VM must be turned off before this step.

In PowerShell, run the following command, adapting the path and size:

& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyhd "C:\Users\<USER>\VirtualBox VMs\<VM_Name>\<DiskName>.vdi" --resize <NewMo>

Example to enlarge to 60 GB:

PS C:\Users\<USER>\VirtualBox VMs> & "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyhd "C:\Users\<USER>\VirtualBox VMs\<VM_Name>\<VM_Name>.vdi" --resize 60000
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
PS C:\Users\<USER>\VirtualBox VMs>

The progression from 0% to 100% confirms that the operation went well.

Attention: this command only enlarges the virtual disk. The partition inside the VM is not yet extended - this is the focus of the next step.


Step 3: Insert GParted ISO into VM

  1. In the VirtualBox manager, select your VM
  2. Click on Configuration -> Storage
  3. Click on the IDE optical drive (Empty)
  4. Click on the disk icon on the right
  5. Select Choose a Disk File...
  6. Navigate to your GParted ISO and select it

You should see gparted-live-x.x.x-amd64.iso appear in the optical drive.


Step 4: Get started on GParted

  1. Start the VM - it will boot to the GParted ISO
  2. In the language menu, select 08 for French
  3. When asked Which mode do you prefer?, choose 0 to start GParted automatically

Step 5: Extend partition with GParted

Once GParted is opened, you see the current partition and the unallocated space.

Delete swap partition (if present)

If you see a linux-swap partition, you need to delete it first to free up space:1. Right click on the linux-swap partition -> Delete 2. Right click on the extended partition -> Delete

You should see 2 pending operations.

Resize primary partition

  1. Right click on /dev/sda1 -> Resize/Move
  2. In the New size field, enter the maximum value available
  3. Set Next free space to 0
  4. Click on Resize/Move

You should see 3 pending operations:

  • Delete linux-swap partition
  • Delete /dev/sda2 (extended)
  • Expand /dev/sda1 from 19.00 GiB to 58.59 GiB

Apply changes

  1. Click on the Apply button (green checkmark) in the toolbar
  2. A confirmation appears: "Do you really want to carry out the pending operations?"
  3. Click on Apply

GParted applies the changes:

Expand /dev/sda1 from 19.00 GiB to 58.59 GiB
e2fsck -f -y -v -C 0 '/dev/sda1'
Operations performed: All operations were completed successfully

Click on Close.


Step 6: Remove ISO and Reboot

  1. Turn off the VM
  2. In Setup -> Storage, remove the GParted ISO from the optical drive
  3. Restart the VM normally

Verification

In the terminal of your Linux VM, check the available space:

df -h

The /dev/sda1 partition should now show the new size.


What I learned

  • VBoxManage enlarges the virtual disk but not the partition - the two operations are independent
  • GParted requires deleting the swap partition before you can extend the primary partition
  • Progress from 0% to 100% in PowerShell confirms that the VDI resizing worked well
  • Never forget to remove the GParted ISO after the operation, otherwise the VM will reboot on it
linux
Share this article

Comments (0)

Be the first to comment!

Related articles