New Question

Cannot resize a VHD to a smaller size

asked 2015-02-04 22:02:38 +0300

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

Description of relevant parts of our environment: * OpenStack Juno from Ubuntu running on controller, neutron, and some KVM nodes. * One Hyper-V system running Cloudbase OpenStack Hyper-V Nova Compute ver {A66D13E0-CE61-47E0-8692-CD1DEA3AC082} installed a couple of weeks ago

Created an Ubuntu Server 14.04 image by making a new VM in Hyper-V, installing from an attached ISO image, saving. Hyper-V disk size was set to 20Gibytes. After installing and turning off this VM, I've uploaded VHD file to glance.

Trying to launch an instance from this image on my Hyper-V machine, I get this:

VHDResizeException: Cannot resize a VHD to a smaller size, the original size is 21474836480, the newer size is 21441282048

in my nova-compute log. Now, 21474836480 is exaclty 20 * 2 * 30 or 20Gibytes. And 21441282048 is exactly 32 * 2 * 20 less than that. Where are the missing 32 Mibytes going? Is this a Glance issue?

Any possible workarounds? Like create the VM by hand with a 19Gibyte VHD, upload that to Glance, then create instances from it? Manually change my instance sizes, adding 32Mibytes to the disk somewhere?

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted

answered 2015-02-05 10:41:33 +0300

cnesa gravatar image

You have to use a slightly bigger flavor than the image size as the VHD/VHDX format has a small overhead because of the internal metadata. e.g. For a 20GB image to be on safe side you should use a 21GB flavor.

edit flag offensive delete link more


Rather than changing my standard flavors, I created a smaller (by 1Gbyte) image and successfully launched an image that way.

Aaron Johnson gravatar imageAaron Johnson ( 2015-02-06 08:54:50 +0300 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2015-02-04 22:02:38 +0300

Seen: 622 times

Last updated: Feb 05 '15