Join us on Facebook!
— Written by Triangles on January 06, 2018 • updated on September 23, 2018 • ID 61 —
My VirtualBox guest OSes always run out of space.
My daily task is to resize a VirtualBox disk, because I ran out of space in it. The operation takes place in two stages: resize the disk itself and then enlarge the primary partition.
I'm going to use VBoxManage
, a tool for managing VirtualBox via the command line. Open a terminal window and use it as follows:
VBoxManage modifyhd </path/to/your/disk.vdi> --resize <new size in MB>
For example:
VBoxManage modifyhd "/home/me/VirtualBox\ VMs/windows\ 7\ 64bit/windows\ 7\ 64bit.vdi" --resize 102400
Note: the path to the .vdi file must be absolute. If it contains spaces, wrap it up in quotes (as I did).
For the gigabytes to megabytes conversion, I found a nice utility here.
Your disk is larger now, but not yet used by the operating system. It is time to use a partition manager to enlarge the primary partition in order to take advantage of the new space available.
You can rely upon GParted for this kind of task. It works fine on Linux, Windows and Mac OS X partitions. On Windows Vista and newer you can also use the Disk Management tool shipped with the operating system utilities.
VirtualBox forum - How to resize a Virtual Drive (link)
VirtualBox site - Chapter 8. VBoxManage (link)
Adding space on a Linux guest is as easy as mounting a disk to the area where space is needed.