tirenweb
tirenweb

Reputation: 31749

Trying to convert from .img to .vdi: VERR_VD_INVALID_SIZE

I'm getting the error below when trying to convert a .img file to .vdi file.

VBoxManage convertfromraw file.img file.vdi
Converting from raw image file="file.img" to file="file.vdi"...
Creating dynamic image with size 814188811483 bytes (776471MB)...
VBoxManage: error: VD: The given disk size 814188811483 is not aligned on a sector boundary (512 bytes)
VBoxManage: error: Error code VERR_VD_INVALID_SIZE at /home/vbox/vbox-6.0.10/src/VBox/Storage/VD.cpp(6231) in function int VDCreateBase(PVDISK, const char*, const char*, uint64_t, unsigned int, const char*, PCVDGEOMETRY, PCVDGEOMETRY, PCRTUUID, unsigned int, PVDINTERFACE, PVDINTERFACE)
VBoxManage: error: Cannot create the disk image "file.vdi": VERR_VD_INVALID_SIZE

I got the .img using "dd" command.

Im using VB 6.0.10 on Ubuntu 14.04.

Upvotes: 3

Views: 6250

Answers (2)

Eric
Eric

Reputation: 25004

In my case, the reason is I had specified a vm size larger than the available size of the disk partition.

Reduce the vm size, then the error is gone.

Upvotes: 1

Kwan
Kwan

Reputation: 199

According to this link, https://forum.openwrt.org/t/error-convert-img-to-vdi/1521. I finally find a solution

You need to pad the image using something like
dd if=original.squashfs.combined.img of=padded.img bs=100m conv=sync
before converting it to a vm image.

Upvotes: 9

Related Questions