I've run out of space on a virtual machine disk which is a vmdk and need to resize the virtual image. Resizing with the command
vboxmanage modifyhd Machine-disk1.vmdk --resize 30720
gives the error
Progress state: VBOX_E_NOT_SUPPORTED
VBoxManage: error: Resize hard disk operation for this format is not implemented yet!
How can I resize a vmdk image?
I've got here because I needed to resize a disk for my Docker (CoreOS) development environment.
CoreOS docs says there's no need to resize the OS partition - that's bogus. After you resize the virtual disk you should follow these instructions and resize the OS partition via GParted:
https://docs.docker.com/articles/b2d_volume_resize/
Simply you have to follow the following steps:
Congratulation, enjoy your free space.
This video will help you: https://youtu.be/ikSIDI535L0
I have a Windows 7 client on a Mac host and this post was VERY helpful. Thanks.
I would add that I didn't use gparted. I did this:
Sweet! I preferred that to using a 3rd party tool with warnings about data loss.
Cheers!
Tried all the solutions here, but nothing seemed to work. After hours of digging I found this blog post and like magic everything works. I had to make little adjustments so here is the modified version. Tested with Docker version 17.06.0-ce, build 02c1d87.
Once developers really start containerising their applications, they often generate a large number of images and quickly fill up the 20GB hard drive space allocated to the Docker virtual machine by default. To make sure the Docker virtual machine has plenty of disk space, we should resize /dev/sda1 to a number that is more reasonable.
Stop the Docker virtual machine
docker-machine stop default
.Boot2Docker package installer ships with a VMDK volume, which VirtualBox’s native tools cannot resize. In order to resize the Docker disk volume, first clone the VDI volume from the default VMDK volume
vboxmanage clonehd /full/path/to/disk.vmdk /full/path/to/disk_resized.vdi --format VDI --variant Standard
.vboxmanage modifyhd /full/path/to/disk_resized.vdi --resize <size in MB>
.default
VM and click on the “Settings” gear on top.docker-machine start default
You can use Vmware player to resize a vmdk. This removes the round trip conversion (noted in other posts) if you want to keep it in vmdk format. Just make sure that when you add the vmdk into vmware, don't click upgrade format when prompted, keep the current one in case VirtualBox doesn't accept it.
VirtualBox for Windows
Resizing your disk file while preserving your virtual machine settings!
Step 1 - Resize the disk file
Start cmd.exe
cd
to Oracle VM VirtualBox's dir (on 64-bit systems:"C:\Program Files\Oracle\VirtualBox\"
)Run these commands (as above):
Windows explorer and "copy address as text" via the address bar should help you get the path you need.
On windows system, The VirtaulBox VM directory underneath your user may contain an XML formatted database file of settings you've configured for your VM. Rename this file, with a
.bak
extension (it has a.vbox
extension). Rename the original.vmdk
file with a.bak
extension as well to avoid another error. You can now safetly perform the third step without the error message to convert the machine back to.vmdk
format, or the "duplicate disk" error.You will be presented with a UID token. Copy this token by drag-highlighting it from the Windows Command Interpetor window and using the
Ctrl+C
keyboard shortcut.Open the
.vbox.bak
file in a text editor such as Notepad++. You'll be presented with an XML-like database file. Look for these lines:On the line
<HardDisk uuid="{some uid}" location="C:\path_to\source.vmdk" ...
, delete the old UID token between the brackets and paste the one you copied from the command window. Make sure that you leave the brackets in place!Save this file, and exit your text editor. Rename the
.vbox.bak
file to give it back its expected extension of.vbox
.Step 2 - Remove the junk
It is now safe to remove the
.bak
files remaining in the directory. What remains is a resized.vmdk
with an updated.vbox
database while with your previously preserved VirtualBox Manager settings.Step 3 - Resize the disk's partition to fill the free space
You can now start the VirtualBox VM Manager and execute your VM, using the appropriate tools for the operating system to fill the new free space.
For Windows VMs, use
diskpart
from the command prompt booted from the Windows Recovery Consule (recovery partition) toSELECT DISK 1
,LIST PARTITION
and gather the partition number of yourC:\
drive, thenSELECT PARTITION #
. You can use theEXTEND SIZE=mb
to resize the Windows C:\ drive to the appropriate value. Make sure you leave room for the recovery and boot partitions! It's safe to subtract 4096 MB from your new virtual disk size to get this value, because of shadow copy and windows recovery files.For Linux VMs, a live
.ISO
of gparted you can boot with the VM's disk file can be found at: http://gparted.org/ It will get you straight into a graphical user interface-based gparted-gtk, from where you can fill your free space.For PPC / Mac VMs,
Disk Utility
from the Finder will asisst you in filling the free space, but you may want to consider the gparted Linux option, as currently the only method of which to boot MacOSX in VirtualBox is hackintosh, and you cannot extend your volume while booted into MacOSX. You may also want to seek out tweaking the VM's settings temporarily forgparted
, to get it to boot. MacOSX partitions are recognized by gparted asHFS
- "Heaping File System" partitions.Step 4 - Cat Photos
Because the internet. ;) You're finished. Enjoy your new resized virtual
.vmdk
disk image with VirtualBox for Windows!