[Openstack-operators] CentOS Image

Jacob Godin jacobgodin at gmail.com
Wed Apr 10 12:17:05 UTC 2013


Just a follow up on this thread for any future Googlers, cloud-init from
EPEL does not actually perform this task for you. With Ubuntu you can use
growpart from cloud-utils. However, at this time, cloud-utils is not
available for CentOS.

The best way to accomplish this is to customize the ramdisk in the image to
resize the partition and filesystem on boot. I used the following tutorials
during this process:
https://thunked.org/stefan/howto-shrink-remote-root-filesystem
http://www.landley.net/writing/rootfs-programming.html

You will want to import the following binaries (and lib dependencies):
e2fsck
fdisk (or another partition table editor)
resize2fs
partprobe

Here is what my (very basic) re-sizing looks like (sysadmins, hide your
eyes):
/sbin/e2fsck -p -f /dev/vda1 1>/dev/null
echo -n "Resizing root partition...."
(echo "d 1"; echo n; echo p; echo 1; echo ; echo ; echo w) | /sbin/fdisk
/dev/vda &>/dev/null
echo " complete."
/sbin/partprobe
/sbin/e2fsck -p -f /dev/vda1 1>/dev/null
echo -n "Resizing root filesystem...."
/sbin/resize2fs /dev/vda1 1>/dev/null
echo " complete."



On Sun, Apr 7, 2013 at 7:23 PM, Jacob Godin <jacobgodin at gmail.com> wrote:

> Great, that seems to be exactly what I need! Thanks Lorin
>
>
> On Sat, Apr 6, 2013 at 5:18 PM, Lorin Hochstein <lorin at nimbisservices.com>wrote:
>
>> Jacob:
>>
>> You can configure a raw or qcow2 image to resize on boot so it uses the
>> entire primary root disk. See the "Support resizing" section of the
>> OpenStack Compute Admin guide for more details:
>>
>>
>> http://docs.openstack.org/folsom/openstack-compute/admin/content/image-customizing-what-you-need-to-know.html#support-resizing
>>
>> I believe that if cloud-init is installed, it will resize the root
>> partition for you by default, although I haven't tested this myself. For
>> CentOS images, you can install cloud-init from EPEL.
>>
>> Lorin
>>
>>
>> On Sat, Apr 6, 2013 at 3:05 PM, Jacob Godin <jacobgodin at gmail.com> wrote:
>>
>>> Hi Lorin,
>>>
>>> It was my understanding that this was the way to have a dynamic root
>>> disk. So I can have, say, a 5GB instance and a 100GB instance use the same
>>> image, rather than limiting the size root FS and giving the rest as
>>> ephemeral storage.
>>>
>>> @Abel: Ubuntu images work just fine
>>>
>>>
>>>
>>> On Sat, Apr 6, 2013 at 12:58 PM, Lorin Hochstein <
>>> lorin at nimbisservices.com> wrote:
>>>
>>>> Out of curiosity, why did you decide to create AMI/ARI/AKI format
>>>> images instead of qcow2? Curious because I thought that was a legacy thing
>>>> that nobody did anymore.
>>>>>>>> Sent from Mailbox <https://bit.ly/SZvoJe> for iPhone
>>>>
>>>>
>>>> On Fri, Apr 5, 2013 at 11:32 AM, Jacob Godin <jacobgodin at gmail.com>wrote:
>>>>
>>>>> Hi all,
>>>>>
>>>>> I have created a CentOS image using the AMI + AKI + ARI method (same
>>>>> as I used to create my Ubuntu images). I am able to successfully upload and
>>>>> launch the image at first. When trying to launch the third+ instances, they
>>>>> simply get stuck in a bootloop after the 'Booting from ROM...'.
>>>>>
>>>>> Even if I delete the original two images, I am unable to boot. The
>>>>> only way to get a CentOS image to successfully boot is to re-upload the
>>>>> image.
>>>>>
>>>>> Any ideas? I'm using Folsom w/ Ceph RBD storage for images, and CephFS
>>>>> for instances.
>>>>>
>>>>
>>>>
>>>
>>
>>
>> --
>> Lorin Hochstein
>> Lead Architect - Cloud Services
>> Nimbis Services, Inc.
>> www.nimbisservices.com
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-operators/attachments/20130410/1b3f8296/attachment.html>


More information about the OpenStack-operators mailing list