Convert from RAW to VDI

When creating custom “RAW” images using mkimg they can be use in VirtualBox by converting them to “VDI” format, example:

$ VBoxManage convertfromraw ec2.raw ec2.vdi --format VDI
Converting from raw image file="ec2.raw" to file="ec2.vdi"...
Creating dynamic image with size 3221292544 bytes (3073MB)...

Once the image is in “VDI” format it can be resized using:

$ VBoxManage modifyhd ec2.vdi --resize 8192
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%

The above command will resize the image to 8GB.

VMware

If using VMware, virtual disks can be expanded using this ESXi/ESX command:

vmkfstools -X <new size> <virtual disk>.vmdk

For example, use this command to grow the virtual disk to 25GB in size:

vmkfstools -X 25g /vmfs/volumes/xxxx/vmname/vmname.vmdk