How to resize a VirtualBox vmdk file

515 0

If you want to end having back a vmdk hard disk (maybe you are interested in using the disk in vwmare too), the complete steps are:

VBoxManage clonemedium "source.vmdk" "cloned.vdi" --format vdi
VBoxManage modifymedium "cloned.vdi" --resize 51200
VBoxManage clonemedium "cloned.vdi" "resized.vmdk" --format vmdk

The above will resize the hard disk up to 50GB (50 * 1024MB).

To complete things you need to resize the drive too! To achieve this, you might want to download gparted iso and boot from that iso to resize your drive (select the iso from within the virtualbox settings).

If you type VBoxManage in the command prompt, you expect a list of commands to pop up. However, when the command is not added to the PATH, it just won’t work. The PATH is the list of directories of which Windows can run executables from. VBoxManage.exe is the one you are trying to launch, but Windows has not identified the directory of this program.

The solutions is simple. Browse to the directory of your VirtualBox installation, and copy the pathname. For me this is ‘C:\Program Files\Oracle\VirtualBox’. Then, you have these 2 options:

  • Execute the commands form that folder, adapting the paths to the virtual disks files.
  • Adding this directory to the PATH variable is the easiest by simply running the set command in your command prompt, as follows:
set PATH=%PATH%;"C:\Program Files\Oracle\VirtualBox"
Carlos Pérez

Digital manager, tech lead, product designer, full stack engineer, web and app developer, SEO, digital marketing, automation and AI expert.

Leave a Reply

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