Skip to content

Commit

Permalink
tree: import changes from testing-devel at 38f5342
Browse files Browse the repository at this point in the history
  • Loading branch information
coreosbot committed Oct 3, 2019
1 parent 5e74cb0 commit c5b705c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions overlay.d/05core/usr/libexec/coreos-growpart
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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

Expand Down

0 comments on commit c5b705c

Please sign in to comment.