How to resize a VirtualBox vmdk file
VirtualBox is a powerful x86 and AMD64/Intel64 virtualization product for enterprise as well as home use. Not only is VirtualBox an extremely feature rich, high performance product for enterprise customers, it is also the only professional solution that is freely available as Open Source Software.
VMDK (Virtual Machine Disk) is a file format that describes containers for virtual hard disk drives to be used in virtual machines like VMware Workstation or Oracle VirtualBox.
In the earlier post we have looked at how to install Ubuntu on Oracle VirtualBox.There could be scenarios where in you would run out of space on Virtualbox and need to resize the virtual image, following steps would help you to resize VMDK file.
- Add “VirtualBox Installation location” to the Path variable
- We are going to use
VBoxManagecommand line interface to resize the disk. With VBoxManage, you can completely control VirtualBox from the command line of your host operating system. VBoxManage supports all the features that the graphical user interface gives you access to, but it supports a lot more than that.
- For resizing the disk,first convert the vmdk file to vdi format using following command
VBoxManage clonehd "ubuntu1864.vmdk" "cloned.vdi" --format vdiHere ubuntu1864.vmdk is the file which we are going to resize & cloned.vdi is intermediate file in vdi format.
- Then resize the vdi file to required size using following command
VBoxManage modifyhd "cloned.vdi" --resize 51200Here cloned.vdi is intermediate file in vdi format.
- Next step is to convert the vdi file back to vmdk file using following command
VBoxManage clonehd "cloned.vdi" "ubuntu18641.vmdk" --format vmdkHere ubuntu18641.vmdk is the resultant file & cloned.vdi is intermediate file in vdi format.
- Once the conversion & resize is completed,we would need to download GParted Live CD to resize the disk.On your VirtualBox Storage settings,set Gparted Live CD and boot the image.
- On the GParted boot screen,choose default settings.
- Resize the disk using the slider per your needs.
- Choose ‘Apply Changes’ and Resizing would be complete.
Congrats! We have now resized the disk, continue using VirtualBox.
Like this post? Don’t forget to share it!