How to resize a VirtualBox VDI file on Mac OS

Recently, I had to do this as 10GB was not sufficient for Centos6.7 VM. I would just like to mention simple steps for how to do it.

  1. Shutdown VM and quit from VirtualBox.
  2. Open the terminal and go to the below path (default location). From here you can run the command to resize the VDI file.
    Nils-Mac:MacOS nilnandan$ pwd
    Nils-Mac:MacOS nilnandan$ 
  3. Start another terminal with command + T and find the directory where actually the VDI file stored. Default location would be ,
    Nils-Mac:centos67-mysql nilnandan$ pwd
    /Users/nilnandan/VirtualBox VMs/centos67-mysql
    Nils-Mac:centos67-mysql nilnandan$ ls -alh
    total 21925920
    drwx------   7 nilnandan  staff   238B Aug 11 18:15 .
    drwx------  12 nilnandan  staff   408B Aug 11 17:50 ..
    drwx------   6 nilnandan  staff   204B Aug 11 17:50 Logs
    drwx------   2 nilnandan  staff    68B Aug 11 17:47 Snapshots
    -rw-------   1 nilnandan  staff    10G Aug 11 18:20 centos67-3.vdi
    -rw-------   1 nilnandan  staff   7.7K Aug 11 18:15 centos67-mysql.vbox
    -rw-------   1 nilnandan  staff   7.7K Aug 11 17:50 centos67-mysql.vbox-prev
    Nils-Mac:centos67-mysql nilnandan$ 
  4. Now from the location of step 2, run the command to resize it. I’m going to increase size from 10GB to 25GB
    Nils-Mac:MacOS nilnandan$ VBoxManage modifyhd --resize 25600 /Users/nilnandan/VirtualBox VMs/centos67-mysql/centos67-3.vdi
    Oracle VM VirtualBox Command Line Management Interface Version 5.0.12
    (C) 2005-2015 Oracle Corporation
    All rights reserved.
    VBoxManage modifymedium [disk|dvd|floppy] <uuid|filename>
     [--type normal|writethrough|immutable|shareable|
     [--autoreset on|off]
     [--property <name=[value]>]
     [--resize <megabytes>|--resizebyte <bytes>]
    Syntax error: Invalid parameter 'VMs/centos67-mysql/centos67-3.vdi'
    Nils-Mac:MacOS nilnandan$
  5. Here, I got the error because there is a space between VirtualBox and VMs so I have to use escape character to solve this,
    Nils-Mac:MacOS nilnandan$ VBoxManage modifyhd --resize 25600 /Users/nilnandan/VirtualBox\ VMs/centos67-mysql/centos67-3.vdi
    Nils-Mac:MacOS nilnandan$ 
  6. Now, when you’ll check the size, it will be
    Nils-Mac:MacOS nilnandan$ VBoxManage showhdinfo /Users/nilnandan/VirtualBox\ VMs/centos67-mysql/centos67-3.vdi
    Location:       /Users/nilnandan/VirtualBox VMs/centos67-mysql/centos67-3.vdi
    Storage format: VDI
    Format variant: dynamic default
    Capacity:       25600 MBytes
    Size on disk:   10706 MBytes
    Encryption:     disabled
    Nils-Mac:MacOS nilnandan$ 
  7. It’s done. Just open the VirtualBox and start VM


12 thoughts on “How to resize a VirtualBox VDI file on Mac OS

  1. Hi – my actual path to my vdi file is :
    David /VirtualBox VMs /Windows 10 (64-bit) /Windows 10 (64-bit).vdi

    No matter what I do, however, I get a syntax error when running the resize function when entering this path – can you please help me?

    Thanks so much

  2. Hi
    My (your!) command
    VBoxManage modifyhd –resize 51200 /Users/Phi/VirtualBox\ VMs/W10/W10.vdi
    I get the errors
    VBoxManage: error: Cannot register the hard disk ‘/Users/Phi/VirtualBox VMs/W10/W10.vdi’ {52742b7d-d7f9-4bff-bb06-d30699c40b1a} because a hard disk ‘/Users/phi/VirtualBox VMs/W10/W10.vdi’ with UUID {52742b7d-d7f9-4bff-bb06-d30699c40b1a} already exists
    VBoxManage: error: Details: code NS_ERROR_INVALID_ARG (0x80070057), component VirtualBoxWrap, interface IVirtualBox, callee nsISupports
    VBoxManage: error: Context: “OpenMedium(Bstr(pszFilenameOrUuid).raw(), enmDevType, enmAccessMode, fForceNewUuidOnOpen, pMedium.asOutParam())” at line 179 of file VBoxManageDisk.cpp

    Any idea ?

  3. Everything works under MacOS and VirtualBox also show the disk size are increased. However, while starting the virtual machine, the command df in Ubuntu 18.04 still shows no change in total disk space!

    1. you will need to modify the partition size in the partition utility, you will see unallocated space…

    2. Yeah, this whole article can be done via the GUI in VitualBox, it simply makes the volume larger but does nothing to the partition that you’re using. It’s like half of the article is missing.

  4. I got this syntax in VB Mac
    VBoxManage modifyhd –resize 23000 ~/Users/gabrielmoran/VirtualBox\VMs/Ubuntu/Ubuntu.vdi
    VBoxManage: error: Could not find file for the medium ‘/Users/gabrielmoran/Users/gabrielmoran/VirtualBoxVMs/Ubuntu/Ubuntu.vdi’ (VERR_FILE_NOT_FOUND)
    VBoxManage: error: Details: code VBOX_E_FILE_ERROR (0x80bb0004), component MediumWrap, interface IMedium, callee nsISupports
    VBoxManage: error: Context: “OpenMedium(Bstr(pszFilenameOrUuid).raw(), enmDevType, enmAccessMode, fForceNewUuidOnOpen, pMedium.asOutParam())” at line 191 of file VBoxManageDisk.cpp

  5. I tried to resize the win10 disk on my MBP with Mojave and up to date vbos & got the error below. Any Ideas?

    sh-3.2# VBoxManage modifyhd –resize 81920 /Users/Administrator/VirtualBox\ VMs/WIN10/WIN10.vdi
    Progress state: VBOX_E_NOT_SUPPORTED
    VBoxManage: error: Failed to resize medium
    VBoxManage: error: Resizing to new size 85899345920 is not yet supported for medium ‘/Users/Administrator/VirtualBox VMs/WIN10/WIN10.vdi’
    VBoxManage: error: Details: code VBOX_E_NOT_SUPPORTED (0x80bb0009), component MediumWrap, interface IMedium
    VBoxManage: error: Context: “RTEXITCODE handleModifyMedium(HandlerArg *)” at line 816 of file VBoxManageDisk.cpp

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.