Virtual Box HD commands


Since I already have a set of base virtual disks from a number of laboratories I have created for various projects, it makes sense to reuse them as many of them have the right OS settings for my common requirements. Currently working with OEM 12c and having limited space on my SSD, I decided to enlarge the HDs. I am using VirtualBox in my local labs.

Depending on your requirements, the disk format you are using, etc., the process I followed required dettaching the disk, converting it to a format VBox could resize, actually enlarging the disk file, and attaching it again to the VM.

The following commands can be useful in preparing disks as described:

  • vboxmanage storageattach VM --storagectl CONTROLLER --port PORT --type hdd --medium none
  • vboxmanage internalcommands sethduuid /path/to/disk
  • vboxmanage clonehd --format FORMAT /path/to/disk /path/to/newdisk
  • vboxmanage modifyhd /path/to/newdisk --resize SIZEvboxmanage storageattach VM --storagectl CONTROLLER --port PORT --type hdd --medium /path/to/newdisk

Naturally, the former disk has no further use in this situation and can be discarded. The OS must also be reconfigured to view the new partition size.