From 520e12ec2981352246e283a8ed37beefa5ccc2b2 Mon Sep 17 00:00:00 2001 From: Michal Nasiadka Date: Thu, 27 Aug 2020 12:19:00 +0200 Subject: [PATCH] Disable growpart in cloud-init-disable-resizefs This disables growpart module in cloud-init, not resizing / partition to maximum disk free size by default. Change-Id: I69984a9141fa8abb12dc5d51bd334f9280deca67 --- .../elements/cloud-init-disable-resizefs/README.rst | 4 ++-- .../post-install.d/51-cloud-init-disable-growpart | 9 +++++++++ .../cloud-init-resizefs-growpart-e820b8c7f3adb78b.yaml | 5 +++++ 3 files changed, 16 insertions(+), 2 deletions(-) create mode 100755 diskimage_builder/elements/cloud-init-disable-resizefs/post-install.d/51-cloud-init-disable-growpart create mode 100644 releasenotes/notes/cloud-init-resizefs-growpart-e820b8c7f3adb78b.yaml diff --git a/diskimage_builder/elements/cloud-init-disable-resizefs/README.rst b/diskimage_builder/elements/cloud-init-disable-resizefs/README.rst index 76927fcb8..141253666 100644 --- a/diskimage_builder/elements/cloud-init-disable-resizefs/README.rst +++ b/diskimage_builder/elements/cloud-init-disable-resizefs/README.rst @@ -4,5 +4,5 @@ cloud-init-disable-resizefs The cloud-init resizefs module can be extremely slow and will also unwittingly create a root filesystem that cannot be booted by grub if -the underlying partition is too big. This removes it from cloud.cfg, -putting the onus for resizing on the user post-boot. +the underlying partition is too big. This removes both resizefs and growpart +from cloud.cfg, putting the onus for resizing on the user post-boot. diff --git a/diskimage_builder/elements/cloud-init-disable-resizefs/post-install.d/51-cloud-init-disable-growpart b/diskimage_builder/elements/cloud-init-disable-resizefs/post-install.d/51-cloud-init-disable-growpart new file mode 100755 index 000000000..9ece4b1ba --- /dev/null +++ b/diskimage_builder/elements/cloud-init-disable-resizefs/post-install.d/51-cloud-init-disable-growpart @@ -0,0 +1,9 @@ +#!/bin/bash + +if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then + set -x +fi +set -eu +set -o pipefail + +sed -ie 's/^ - growpart$//' /etc/cloud/cloud.cfg diff --git a/releasenotes/notes/cloud-init-resizefs-growpart-e820b8c7f3adb78b.yaml b/releasenotes/notes/cloud-init-resizefs-growpart-e820b8c7f3adb78b.yaml new file mode 100644 index 000000000..52e683f94 --- /dev/null +++ b/releasenotes/notes/cloud-init-resizefs-growpart-e820b8c7f3adb78b.yaml @@ -0,0 +1,5 @@ +--- +upgrade: + - | + ``cloud-init-disable-resizefs`` will no longer leave ``growpart`` on / + partition to enabled in cloud.cfg.