Virtualbox resize problems

I had an issue with resizing a Virtualbox .vdi file.

Command used:

vboxmanage modify disk.vdi –resize 40960

Error displayed:

VBoxManage: error: Cannot register the hard disk ‘disk.vdi’ {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} because a hard disk ‘disk.vdi’ with UUID {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} already exists

Solution: 

vboxmanage modifyhd {abc03a41-794b-4a84-adaf-789436919417} --resize 40960    (e.g 40gb hd)

replace {abc etc with the correct UUID

 

See the link below for more detail and the solution.

http://amapplease.blogspot.com.au/2011/10/resizing-existing-hdd-image-in.html