Growing xfs root partitions works for my templates, but we are not using lvm on 
our templates.
My cloudstack clusters are using KVM.
So these comments may not be helpful on what works.


I tried to keep as much of the default cloud-init config on all the distros 
I've built templates for (Ubuntu, Rocky, CentOS, and Debian).

My CentOS 7 template is using cloud-init 19.4-7.
My Rocky 8.4 template is using cloud-init 20.3-10.
In both cases xfs root grows fine without lvm.

I found cleaning out /var/log/cloud-init.log and /var/log/cloud-init-output.log 
helpful, especially on Ubuntu which uses cloud-init on all installs.

Initial install of ssh keys works with the default cloud-init configurations 
for Ubuntu, Rocky, CentOS, and Debian.
I have not tried replacing ssh keys from the Cloudstack GUI.

NOTE: 
  On Ubuntu 20 this file causes problems 
/etc/cloud/cloud.config.d/99-installer.cfg
  All Ubuntu versions get it removed.

I have not put an example play and the role for creating templates into my 
gitlab repo yet: https://gitlab.com/coledarr/cloudstack-roles
It's on the list, just haven't gotten to it yet.


I think I've posted this before, but here's my process:
  Create a very minimal install with only enough for ssh login with a known 
password, and simple non-lvm root partition as the last one on the storage.
  I've called them stepping stone templates, and are only used by admins to 
create further templates.
  From that stepping stone template I create a guest instance and run an 
ansible play against it to create templates for users.
  That play setups up enough su or sudo for a role to be applied.
  The prep_template role is fairly simple:
    installs cloud-init and a few other packages depending on the distro (tar, 
cloud-utils-growpart, rsyslog).
    drops a three line cloud config so all our templates have the same default 
user.
    put a final prep script on the guest and run it (delete users, lock root, 
reset cloud-init, remote ssh host keys, etc. then shutdown the guest instance)
  Once that guest instance shuts down I manually create the final templates 
users launch guest instances from.

Darren
-- 
This e-mail is confidential. Any distribution, use or copying of this e-mail or 
the information it contains other than by the intended recipient is forbidden. 
If you are not the intended recipient, please advise the sender (by return 
e-mail or otherwise) immediately and delete this e-mail.

----- Original Message -----
From: "Yordan Kostov" <yord...@nsogroup.com>
To: "users" <us...@cloudstack.apache.org>
Cc: "dev" <dev@cloudstack.apache.org>
Sent: Monday, October 11, 2021 11:39:53 PM
Subject: RE: Root disk resizing

Hey everyone,

        I believe growpart works for EXT4 only and does not work on Centos 
because it is XFS so volume needs to be resized manually. Here is what I use to 
do configure the template scripts:

## Enable XFS root partition auto resize
echo "growpart:
    mode: auto
    devices:
        - \"/dev/xvda2\"
    ignore_growroot_disabled: false" > /etc/cloud/cloud.cfg.d/50_growpartion.cfg

echo "runcmd:
  - [ pvresize, /dev/xvda2 ]
  - [ lvresize, -l, '+100%FREE', /dev/centos/root ]
  - [ xfs_growfs, /dev/centos/root ]" > 
/etc/cloud/cloud.cfg.d/51_extend_volume.cfg


        Full script you can find here -> 
https://github.com/dredknight/cloud_scripts/blob/master/CloudStack-Xen/templates/centos7_clean.bash

I also made an extended article regarding cloud-init features and their 
step-by-step config for CLoudstack but that is committed for 4.16 documentation 
but I am not sure if it is approved for merge or not.
http://qa.cloudstack.cloud/docs/WIP-PROOFING/pr/215/adminguide/templates/_cloud_init.html

Best regards,
Jordan

-----Original Message-----
From: K B Shiv Kumar <s...@indiqus.com.INVALID> 
Sent: Monday, October 11, 2021 6:51 PM
To: us...@cloudstack.apache.org
Cc: dev@cloudstack.apache.org
Subject: Re: Root disk resizing


[X] This message came from outside your organization


I believe there's a section called boothook in cloud-init which is probably 
what you want.

We're also trying things on cloud-init. ☺️

Best Regards
Shiv
(Sent from mobile device. Apologies for brevity and typos)

On Mon, 11 Oct, 2021, 20:55 Marcus, <shadow...@gmail.com> wrote:

> Cloud-init is always fun to debug :-). It will probably require some 
> playing with to get a pattern down.
>
> There is perhaps a way to get it to re-check and grow every reboot if 
> you adjust/override the module frequency, deleting the module 
> semaphore in /var/lib/cloud/sem or worst case clearing the metadata 
> via 'cloud-init clear' or  deleting the /var/lib/cloud.
>
> On Mon, Oct 11, 2021 at 3:07 AM Wido den Hollander <w...@widodh.nl> wrote:
>
> >
> >
> > On 10/10/21 10:35 AM, Ranjit Jadhav wrote:
> > > Hello folks,
> > >
> > > I have implemented cloudstack with Xenserver Host. The template 
> > > has
> been
> > > made out of VM with basic centos 7 and following package installed 
> > > on
> it
> > > ------------------------
> > > sudo yum -y cloud-init
> > > sudo yum -y install cloud-utils-growpart sudo yum -y install gdisk
> > > ------------------------
> > >
> > > After creating new VM with this template, root disk is created as 
> > > per
> > size
> > > mention in template or we are able to increase it at them time of
> > creation.
> > >
> > > But later when we try to increase root disk again, it increases 
> > > disk
> > space
> > > but "/" partiton do not get autoresize.
> > >
> >
> > As far as I know it only grows the partition once, eg, upon first boot.
> > I won't do it again afterwards.
> >
> > Wido
> >
> > >
> > > Following parameters were passed in userdata
> > > ------------------------
> > > #cloud-config
> > > growpart:
> > > mode: auto
> > > devices: ["/"]
> > > ignore_growroot_disabled: true
> > > ------------------------
> > >
> > > Thanks & Regards,
> > > Ranjit
> > >
> >
>

Reply via email to