Ask Your Question
0

resize instance to smaller flavor

asked 2017-07-07 18:47:58 -0600

Damian Dąbrowski gravatar image

Hello,

I'm thinking about resizing instance flavor to smaller so i made these steps:

  • Created instance 'test' with 20GB disk
  • Created snapshot of this instance
  • Downloaded snapshot to local disk
  • Mounted it as loop device
  • shrinked filesystem
  • shrinked partition
  • used qemu-img resize to shrink disk
  • uploaded file as image(now everything looks ok, disk size&partition size are smaller than original)
  • rebuilt instance using new image

and now there is a problem, when i rebuild actual instance with new, smaller image it have 20GB disk again(but partition is smaller). So I still can't change flavor to smaller because I'll see error saying that image size is bigger than new flavor.

Maybe someone know any workaround for shrinking instance size? I would be very grateful for any help.

edit retag flag offensive close merge delete

Comments

1

This is confusing. How large is the disk (use qemu-img info)? How large is the image (openstack image show)? Are you sure the partition table reflects the correct sizes? Where do you see the size of 20GB?

Bernd Bausch gravatar imageBernd Bausch ( 2017-07-07 23:12:09 -0600 )edit

Did you use the same flavor as before? Sounds like you changed the image but not the flavor.

eblock gravatar imageeblock ( 2017-07-10 02:58:03 -0600 )edit

2 answers

Sort by » oldest newest most voted
0

answered 2017-07-13 01:30:24 -0600

TijoV gravatar image

We also had a similar issue, what I mean is if an instance is on 20Gb disks using flavor.m1, you convert it to image and relaunch a new instance using flavor.m1 on 20Gb Disks, the instance creation will fail saying " doesn't fit in a volume of size 20G ". However If we use a 25GB Disks with flavor.m1new the instance will Launch fine.

We used 'qemu' commands to resize the virtual size of the disk to 10Gb and try launch the instance, this time Openstack is able to launch the instance running, but when we looked at the instance console we see its waiting on Grub saying no Kernal available.

So what we conclude is if qcow2 image is created out of 20Gb disks next instance launched out of new image created requires more than 20Gb disks to get the instance running perfectly.

edit flag offensive delete link more
0

answered 2017-07-12 17:11:25 -0600

Damian Dąbrowski gravatar image

Hello,

Bernd - qemu-img info shows smaller disk, image size is smaller too(3G) but when i rebuild machine with this, disk automatically grow up to the flavor size(20G), so it's still impossible to change flavor to smaller one

eblock - after rebulding machine with smaller image i'm trying to change flavor to smaller one but I can't because I'm getting error saying that image size is bigger than new flavor.

edit flag offensive delete link more

Comments

2

"disk automatically grow up to the flavor size" That's normal; disks are extended to the flavor size. After all, the flavor determines the size of your instance; if you select a 20GB flavor, the expectation is that you need 20GB.

Bernd Bausch gravatar imageBernd Bausch ( 2017-07-12 18:53:26 -0600 )edit

Yeah Bernd thanks for reply, but is there any way to omit it? This makes it impossible for me to reduce the flavor size.

If not - is there any way to reduce flavor size when disk size in new flavor is smaller than in old flavor?

Damian Dąbrowski gravatar imageDamian Dąbrowski ( 2017-07-13 07:56:56 -0600 )edit
1

I can think of two ways. If you have admin privileges, create a different flavor. Or create a volume from the image and boot from it, in which case the disk size of the flavor loses its meaning.

In any case, you can't change the extension of ephemeral storage to fit the flavor's disk size.

Bernd Bausch gravatar imageBernd Bausch ( 2017-07-13 08:59:06 -0600 )edit

Yeah, You have pretty nice ideas, but all of them need admin privileges, as You said.

So for now I guess that this isn't possible to shrink instance root disk as a user. Thats quite sad :(

Thank You Bernd for explanation!

Damian Dąbrowski gravatar imageDamian Dąbrowski ( 2017-07-13 10:25:48 -0600 )edit

Your Answer

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

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2017-07-07 18:47:58 -0600

Seen: 1,340 times

Last updated: Jul 13 '17