From c5b705cd70af20904bda9387b4f676fc62052b75 Mon Sep 17 00:00:00 2001 From: CoreOS Bot Date: Thu, 3 Oct 2019 17:27:57 +0000 Subject: [PATCH] tree: import changes from testing-devel at 38f5342e1d819714505dd19c16cfa0cce0b519f4 --- overlay.d/05core/usr/libexec/coreos-growpart | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/overlay.d/05core/usr/libexec/coreos-growpart b/overlay.d/05core/usr/libexec/coreos-growpart index b612dc20f2..9e1c3c1b0a 100755 --- a/overlay.d/05core/usr/libexec/coreos-growpart +++ b/overlay.d/05core/usr/libexec/coreos-growpart @@ -12,6 +12,16 @@ path=$1 shift majmin=$(findmnt -nvr -o MAJ:MIN "$path") + +# Detect if the rootfs is on a luks container and map +# it to the underlying partition. This assumes that the +# LUKS volumes is housed in a partition. +src=$(findmnt -nvr -o SOURCE "$path") +is_luks=0 +if [[ "${src}" =~ /dev/mapper ]]; then + majmin=$(dmsetup table ${src} | cut -d " " -f7) +fi + devpath=$(realpath "/sys/dev/block/$majmin") partition=$(cat "$devpath/partition") parent_path=$(dirname "$devpath") @@ -21,6 +31,12 @@ parent_device=/dev/$(basename "${parent_path}") # we can't resize. growpart "${parent_device}" "${partition}" || true +eval $(blkid -o export "${parent_device}${partition}") +if [ "${TYPE}" == "crypto_LUKS" ]; then + luks_name=$(dmsetup info ${src} -C -o name --noheadings) + cryptsetup resize ${luks_name} +fi + # this part is already idempotent xfs_growfs /sysroot