[Rdo-list] Automatic resizing of root partitions in RDO Icehouse

Shake Chen shake.chen at gmail.com
Thu May 8 06:23:19 UTC 2014


Hi

I use oz create centos image, work perfect for openstack, support resize.

the step is very simple

1: hareware machine, install centos6.5
disable selinux
enable epel

2: install OZ

yum -y install oz

modify the oz setting , let default image is qcow2

/etc/oz/oz.cfg
image_type = qcow2

restart machine.

3: create two file centos6.ks and centos65.tdl

check the attachment. you only need change

http://172.28.0.1/cobbler/ks_mirror/CentOS6.5-x86_64/

to like below link

http://mirrors.163.com/centos/6.5/os/x86_64/


4: run the command

oz-install -p -u -d3 -a centos6.ks centos65.tdl

the image would store /var/lib/libvirt/images

5: compress the image
qemu-img convert -c /var/lib/libvirt/images/centos_65_x86_64.qcow2 -O qcow2
\
/root/centos_65_x86_64.qcow2

Now the image is ok, upload to openstack

the image only support key login

username is  cloud-user

you can check the centos6.ks ,the ks is change from
http://repos.fedorapeople.org/repos/openstack/guest-images/

I also upload the image, you can try it.

http://yunpan.cn/QiQ6syasRAH7Q

password: 90e3




















On Thu, May 8, 2014 at 11:48 AM, Kashyap Chamarthy <kchamart at redhat.com>wrote:

> On Wed, May 07, 2014 at 02:31:43PM +0000, St. George, Allan L. wrote:
> > I haven’t had the time to work with Icehouse yet, but I have outlined
> > instruction that are used to create Havana CentOS images that resize
> > automatically upon spawning via linux-rootfs-resize.
> >
> > If interested, I’ll forward it along.
>
> That'd be useful. It'd be even better if you could make a quick RDO wiki
> page[1] that'll be indexed by the search engines.
>
>
> [1] http://openstack.redhat.com/
>
> PS: If you're a Markdown user, you can convert Markdown -> WikiMedia
> (RDO uses WikiMedia for wiki) trivially like this:
>
>     $ pandoc -f markdown -t Mediawiki foo.md -o foo.wiki
>
> >
> > From: rdo-list-bounces at redhat.com [mailto:rdo-list-bounces at redhat.com]
> > On Behalf Of Elías David Sent: Tuesday, May 06, 2014 12:57 PM To:
> > Kashyap Chamarthy Cc: rdo-list at redhat.com Subject: Re: [Rdo-list]
> > Automatic resizing of root partitions in RDO Icehouse
> >
> >
> > Hi thanks for the answers!
> >
> > But how is the support right now in OpenStack with centos/fedora
> > images regarding the auto resizing during boot? does the disk size set
> > in the flavor is respected or not, or does it work only with fedora
> > and newer kernels than what CentOS uses...things like that is what I'm
> > looking for On May 6, 2014 4:09 AM, "Kashyap Chamarthy"
> > <kchamart at redhat.com<mailto:kchamart at redhat.com>> wrote: On Mon, May
> > 05, 2014 at 10:22:26PM -0430, Elías David wrote:
> > > Hello all,
> > >
> > > I would like to know what's the current state of auto resizing the
> > > root partition in current RDO Icehouse, more specifically, CentOS
> > > and Fedora images.
> > >
> > > I've read many versions of the story so I'm not really sure what
> > > works and what doesn't.
> > >
> > > For instance, I've read that currently, auto resizing of a CentOS
> > > 6.5 image for would require the filesystem to be ext3 and I've also
> > > read that auto resizing currently works only with kernels >= 3.8, so
> > > what's really the deal with this currently?
> > >
> > > Also, it's as simple as having cloud-init, dracut-modules-growroot
> > > and cloud-initramfs-tools installed on the image or are there any
> > > other steps required for the auto resizing to work?
> >
> >
> > I personally find[1] virt-resize (which works the same way on any
> > images) very useful when I'd like to do resizing, as it works
> > consistent well.
> >
> > I just tried on a Fedora 20 qcow2 cloud image with these below four
> > commands and their complete output.
> >
> > 1. Examine the root filesystem size _inside_ the cloud image:
> >
> >     $ virt-filesystems --long --all -h -a fedora-latest.x86_64.qcow2
> >
> >     Name       Type        VFS   Label  MBR  Size  Parent /dev/sda1
> >     filesystem  ext4  _/     -    1.9G  - /dev/sda1  partition   -
> >     -      83   1.9G  /dev/sda /dev/sda   device      -     -      -
> >     2.0G  -
> >
> > 2. Create a new qcow2 disk of 10G:
> >
> >     $ qemu-img create -f qcow2 -o preallocation=metadata \
> >     newdisk.qcow2 10G
> >
> > 3. Perform the resize operation:
> >
> >     $ virt-resize --expand /dev/sda1 fedora-latest.x86_64.qcow2 \
> >     newdisk.qcow2 Examining fedora-latest.x86_64.qcow2 ...  **********
> >
> >     Summary of changes:
> >
> >     /dev/sda1: This partition will be resized from 1.9G to 10.0G.  The
> >     filesystem ext4 on /dev/sda1 will be expanded using the
> >     'resize2fs' method.
> >
> >     ********** Setting up initial partition table on newdisk.qcow2 ...
> >     Copying /dev/sda1 ...  100%
> >
> ⟦▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒⟧
> >     00:00 Expanding /dev/sda1 using the 'resize2fs' method ...
> >
> >     Resize operation completed with no errors.  Before deleting the
> >     old disk, carefully check that the resized disk boots and works
> >     correctly.
> >
> > 4. Examine the root file system size in the new disk (should reflect
> > correctly):
> >
> >     $ virt-filesystems --long --all -h -a newdisk.qcow2 Name
> >     Type        VFS   Label  MBR  Size  Parent /dev/sda1  filesystem
> >     ext4  _/     -    10G   - /dev/sda1  partition   -     -      83
> >     10G   /dev/sda /dev/sda   device      -     -      -    10G   -
> >
> >
> > Hope that helps.
> >
> >
> >   [1]
> >
> http://kashyapc.com/2013/04/13/resize-a-fedora-19-guest-with-libguestfs-tools/
> >
> >
> >
> > -- /kashyap
>
> > _______________________________________________
> > Rdo-list mailing list
> > Rdo-list at redhat.com
> > https://www.redhat.com/mailman/listinfo/rdo-list
>
>
> --
> /kashyap
>
> _______________________________________________
> Rdo-list mailing list
> Rdo-list at redhat.com
> https://www.redhat.com/mailman/listinfo/rdo-list
>



-- 
Shake Chen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rdoproject.org/pipermail/dev/attachments/20140508/8d1d8ea2/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: centos65.tdl
Type: application/octet-stream
Size: 368 bytes
Desc: not available
URL: <http://lists.rdoproject.org/pipermail/dev/attachments/20140508/8d1d8ea2/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: centos6.ks
Type: application/octet-stream
Size: 3001 bytes
Desc: not available
URL: <http://lists.rdoproject.org/pipermail/dev/attachments/20140508/8d1d8ea2/attachment-0001.obj>


More information about the dev mailing list