Skip to content

[DEV-1038] Cloud init lvm growpart #46

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Sep 5, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions elements/cloud-init-growpart-lvm/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
=============
cloud-init-growpart-lvm
=============

This element enables growpart for OS images with LVM.
To enable this element simply include it in the elements list.

Dependencies:
* ``/usr/bin/growpart`` is needed on the system in order to grow the partition.
However it is part of different packages depending on linux family. That
is already taken care of by package-installs.
4 changes: 4 additions & 0 deletions elements/cloud-init-growpart-lvm/package-installs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
cloud-utils-growpart:
when: DISTRO_NAME!=ubuntu
cloud-guest-utils:
when: DISTRO_NAME=ubuntu
19 changes: 19 additions & 0 deletions elements/cloud-init-growpart-lvm/post-install.d/55-growpart-lvm
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail

if [ -d /etc/cloud/cloud.cfg.d ]; then
cat > /etc/cloud/cloud.cfg.d/55-growpart-lvm.cfg <<EOF
#cloud-config
growpart:
mode: auto
devices:
- "/dev/vda3"
- "/dev/sda3"
ignore_growroot_disabled: false
EOF
fi