[Openstack] Instance flavor root disk partition problem

Scott Moser smoser at ubuntu.com
Wed Dec 12 16:34:19 UTC 2012


On Tue, 11 Dec 2012, João Soares wrote:

> Hi,
>
>
>
> I have set up a CentOS VM according to this tutorial
>
> https://www.ibm.com/developerworks/mydeveloperworks/wikis/home/wiki/OpenStac
> k/page/Creating%20qcow2%20CentOS%20Image%20for%20OpenStack?lang=en
>
>
>
> I uploaded it to glance and can boot up a nice instance (1cpu, 1GB RAM). The
> disk size is 10GB because that is the size I set up for the image.
>
> However my problem comes when I want to set a root disk, e.g. 15GB. The
> Instance boots normally, if I do an fdisk ?l I can see that the size of the
> disk is 15GB however the partition still has the original size, i.e. 10GB,
> and if a do a df ?h it in fact only says I have 10GB.
>
> This does not happen for example with the cirros image. How can I make the
> 15GB available on the VM when it boots?

When an instance's disk is resized up, zeros are just added to the end.
As a result the new instance will still have 2 issues to address.

a.) have a partition table that only covers the original size

  To address this, both Ubuntu images and cirros use 'growpart' from
  cloud-utils.

  Due to a limitation in the linux kernel, you cannot modify
  a partition table of a disk that has partition currently mounted (you
  can for lvm, but not for "raw disks").  So, this has to happen inside
  the initramfs before the root volume is mounted, or a reboot has to be
  done to free the mount of /.

  (Note, I've been told that newer kernels have a mechanism for growing a
   partition while its mounted, but I've not really looked into it.  Also
   growpart doesn't/wont work for GPT partitions... patches welcome)

b.) have a filesystem that fills that original size.

  cirros runs resize2fs on the root partition once per instance.
  In Ubuntu images, that is handled by cloud-init, but in order for
  resize2fs to do anything, 'a' must have been addressed first.


More information about the Openstack mailing list