0

I've read in another post (How do I increase the hard disk size of the virtual machine?) that to change the size of a Virtual Disk Image(.vdi) one can use the following command:

VBoxManage modifyhd YOUR_HARD_DISK.vdi --resize SIZE_IN_MB

However, is this enough? Don't you have to resize the partition?

Zanna
  • 70,465
  • You have to resize the partition. Increasing a partition size is trivial, but decreasing it is complicated and risky. Try compacting the virtual disk? It will still let the guest grow, but will not use host storage space on empty guest disk. – le3th4x0rbot Jun 18 '15 at 16:45

1 Answers1

1

The linked question addresses increasing the size of a virtual disk. Big picture, to do this, you give the VBoxManage command to increase the image size, then start the virtual machine, and use gparted or equivalent to increase the partition size.

If you want to decrease the size, you would have to reverse the steps - first shrink the partition inside the VM, then use VBoxManage to decrease the image size (assuming this is possible - I have not tried). I also do not know what would happen if you gave the VBoxManage parameters that would decrease the size of the file smaller than the partition(s) inside.

There are ways of shrinking the virtualbox file size that are not so dramatic, if that is what your end goal really is. This is called 'compacting' the drive and shrinks the virtualbox file size to only the space that is actually used.

If you plan to do any of this stuff, I strongly advise backing up any important data first.

Organic Marble
  • 23,641
  • 15
  • 70
  • 122