[Rdo-list] Automatic resizing of root partitions in RDO Icehouse
Elías David
elias.moreno.tec at gmail.com
Wed May 14 02:53:18 UTC 2014
Hey!
I documented it here:
http://openstack.redhat.com/Creating_CentOS_and_Fedora_images_ready_for_Openstack
Odd thing though, when I was doing the previews all looked ok, upon saving
the margins where off :-/ in any case, the doc is there, feel free to add
anything I could've missed ;)
On Tue, May 13, 2014 at 8:47 AM, St. George, Allan L. <
ALLAN.L.ST.GEORGE at leidos.com> wrote:
> Great, I’m glad it helped. I wanted my spawn to automatically
> join/report to foreman, which is why I included it on my image.
>
>
>
> I’m not familiar with RDO docs, but I wouldn’t have any problem with the
> document being posted.
>
>
>
> V/R,
>
>
>
> Allan
>
>
>
> *From:* Elías David [mailto:elias.moreno.tec at gmail.com]
> *Sent:* Saturday, May 10, 2014 12:59 PM
>
> *To:* St. George, Allan L.
> *Cc:* Kashyap Chamarthy; rdo-list at redhat.com
>
> *Subject:* Re: [Rdo-list] Automatic resizing of root partitions in RDO
> Icehouse
>
>
>
> Hey, thanks! this method indeed worked nicely with CentOS 6.5 image in RDO
> Icehouse! :D
>
>
>
> I didn't do the puppet part since I've no puppet server to test but it
> wasn't needed, also I used virt-sparcify instead of step 13 qemu-image
> convert
>
>
>
> I also tried the oz-install method but it failed everytime with the
> following exception:
>
>
>
> "raise oz.OzException.OzException("No disk activity in %d seconds,
> failing. %s" % (inactivity_timeout, screenshot_text))"
>
>
>
> No matter the install type (url or iso) and didn't matter creating this in
> different machines with different specs (more ram, cpu, fast disks...)
>
>
>
> Anyhow, thank you all for the help and tips! very appreciated ;)
>
>
>
> Any chance to include this method in RDO docs?
>
>
>
> On Fri, May 9, 2014 at 8:34 AM, St. George, Allan L. <
> ALLAN.L.ST.GEORGE at leidos.com> wrote:
>
> I'm sure someone could make this better, but this is what I've been using
> and it works well:
>
> V/R,
>
> Allan
>
> 1. Create disk image with QCOW2 format
>
> qemu-img create -f qcow2 /tmp/centos-6.5-working.qcow2 10G
>
> 2. Install CentOS; Install onto a single ext4 partition mounted to “/” (no
> /boot, /swap, etc.)
>
> virt-install --virt-type {kvm or qemu} --name centos-6.5 --ram 1024 \
> --cdrom=/tmp/CentOS-6.5-x86_64-minimal.iso \
> --disk /tmp/centos-6.5-working.qcow2,format=qcow2 \
> --network network=default \
> --graphics vnc,listen=0.0.0.0 --noautoconsole \
> --os-type=linux --os-variant=rhel6
>
> 3. Eject the disk and reboot the virtual machine
>
> virsh attach-disk --type cdrom --mode readonly centos-6.5 "" hdc
> virsh destroy centos-6.5
> virsh start centos-6.5
>
> 4. After reboot, login into your new image and modify
> '/etc/sysconfig/network-scripts/ifcfg-eth0' to look like this
>
> DEVICE="eth0"
> BOOTPROTO="dhcp"
> NM_CONTROLLED="no"
> ONBOOT="yes"
> TYPE="Ethernet"
>
> 5. Add EPEL repository and update OS
>
> rpm -ivh
> http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
> rpm -ivh
> https://yum.puppetlabs.com/el/6/products/x86_64/puppetlabs-release-6-7.noarch.rpm
>
> 6. Update yum and install cloud-init
>
> yum -y update
> yum install cloud-utils cloud-init parted git
> cd /tmp
> git clone https://github.com/flegmatik/linux-rootfs-resize.git (installed
> in place of cloud-initramfs-tools)
> cd linux-rootfs-resize
> ./install
>
> Edit /etc/cloud/cloud.cfg
>
> Add the line:
>
> user: ec2-user
> Under “cloud_init_modules”, add:
> - resolv-conf
>
> 7. Install and configure puppet
>
> yum install puppet
> edit /etc/hosts and add entry for foreman
> edit /etc/puppet/puppet.conf and add the following lines:
>
> [main]
> pluginsync = true
> [agent]
> runinterval=1800
> server = {server.domain}
> chkconfig puppet on
>
> 8. Enable the instance to access the metadata service
>
> echo "NOZEROCONF=yes" >> /etc/sysconfig/network
>
> 9. Configure /etc/ssh/sshd_config
>
> Uncomment the following lines:
>
> PermitRootLogin yes
> PasswordAuthentication yes
>
> 10. Power down your virtual Centos machine
>
> 11. Clean up the virtual machine of MAC address, etc.
>
> virt-sysprep -d centos-6.5
>
> 12. Undefine the libvirt domain
>
> virsh undefine centos-6.5
>
> 13. Compress QCOW2 image with
>
> qemu-img convert -c /tmp/centos-6.5-working.qcow2 -O qcow2
> /tmp/centos.qcow2
>
>
> Image /tmp/centos-6.5.qcow2 is now ready for upload to Openstack
>
>
>
> -----Original Message-----
> From: Kashyap Chamarthy [mailto:kchamart at redhat.com]
> Sent: Wednesday, May 07, 2014 11:49 PM
> To: St. George, Allan L.
> Cc: rdo-list at redhat.com; Elías David
> Subject: Re: [Rdo-list] Automatic resizing of root partitions in RDO
> Icehouse
>
> 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-libguestf
> > s-tools/
> >
> >
> >
> > -- /kashyap
>
> > _______________________________________________
> > Rdo-list mailing list
> > Rdo-list at redhat.com
> > https://www.redhat.com/mailman/listinfo/rdo-list
>
>
> --
> /kashyap
>
>
>
>
>
> --
>
> Elías David.
>
--
Elías David.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rdoproject.org/pipermail/dev/attachments/20140513/6a8c5c80/attachment.html>
More information about the dev
mailing list