[Openstack-operators] Problem creating resizable CentOS 6.5 image

Regan McDonald regan at wavefunction.org
Mon Oct 6 18:38:21 UTC 2014


Seconded. This is what I use with my CentOS images, and it works great.

On Mon, Oct 6, 2014 at 1:54 PM, Robert Plestenjak <robert.plestenjak at xlab.si
> wrote:

> Try this:
>
> https://github.com/flegmatik/linux-rootfs-resize
>
> - Robert
>
> ----- Original Message -----
> From: "Antonio Messina" <antonio.s.messina at gmail.com>
> To: "Robert van Leeuwen" <Robert.vanLeeuwen at spilgames.com>
> Cc: openstack-operators at lists.openstack.org
> Sent: Friday, October 3, 2014 2:50:44 PM
> Subject: Re: [Openstack-operators] Problem creating resizable CentOS 6.5
>       image
>
> I use this snippet in my %post section. I don't find it particularly
> elegant, but it works just fine:
>
>     # Set up to grow root in initramfs
>     cat << EOF > 05-grow-root.sh
>     #!/bin/sh
>
>     /bin/echo
>     /bin/echo Resizing root filesystem
>
>     /bin/echo "d
>     n
>     p
>     1
>
>
>     w
>     " | /sbin/fdisk -c -u /dev/vda
>     /sbin/e2fsck -f /dev/vda1
>     /sbin/resize2fs /dev/vda1
>     EOF
>
>     chmod +x 05-grow-root.sh
>
>     dracut --force --include 05-grow-root.sh /mount --install 'echo
> fdisk e2fsck resize2fs' /boot/"initramfs-grow_root-$(ls /boot/|grep
> initramfs|sed s/initramfs-//g)" $(ls /boot/|grep vmlinuz|sed
> s/vmlinuz-//g)
>     rm -f 05-grow-root.sh
>
>     tail -4 /boot/grub/grub.conf | sed
> s/initramfs/initramfs-grow_root/g| sed s/CentOS/ResizePartition/g |
> sed s/crashkernel=auto/crashkernel=0 at 0/g >> /boot/grub/grub.conf
>
> It only works if the root filesystem is `/dev/vd1` (which is a very
> common setup anyway) but can be adapted.
>
> I only tested it with CentOS 5 and 6. The full script is available at
> https://github.com/gc3-uzh-ch/openstack-tools/
>
> .a.
>
>
> --
> antonio.s.messina at gmail.com
> antonio.messina at uzh.ch                     +41 (0)44 635 42 22
> S3IT: Service and Support for Science IT   http://www.s3it.uzh.ch/
> University of Zurich
> Winterthurerstrasse 190
> CH-8057 Zurich Switzerland
>
> _______________________________________________
> OpenStack-operators mailing list
> OpenStack-operators at lists.openstack.org
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-operators
>
> _______________________________________________
> OpenStack-operators mailing list
> OpenStack-operators at lists.openstack.org
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-operators
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-operators/attachments/20141006/53dda675/attachment.html>


More information about the OpenStack-operators mailing list