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

Kashyap Chamarthy kchamart at redhat.com
Tue May 6 08:39:01 UTC 2014


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




More information about the dev mailing list