From 5ca3e89132969eb5e880d6b786fc0cdc2328dba9 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Mon, 17 Sep 2018 12:49:14 -0400 Subject: [PATCH] Drop LVM, use custom growpart wrapper Closes: https://github.com/openshift/os/issues/293 --- cloud.ks | 12 ++---------- compose-post.sh | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 10 deletions(-) diff --git a/cloud.ks b/cloud.ks index bf4b2810..842d35ba 100644 --- a/cloud.ks +++ b/cloud.ks @@ -27,10 +27,8 @@ clearpart --initlabel --all # - $coreos_firstboot # This is actually a GRUB variable bootloader --timeout=1 --append="no_timer_check console=ttyS0,115200n8 console=tty0 net.ifnames=0 biosdevname=0 ip=dhcp rd.neednet=1 rw $coreos_firstboot" -part /boot --size=300 --fstype="xfs" -part pv.01 --grow -volgroup coreos pv.01 -logvol / --size=3000 --fstype="xfs" --name=root --vgname=coreos +part /boot --size=300 --fstype="xfs" --label=boot +part / --size=3000 --fstype="xfs" --label=root --grow ostreesetup --nogpg --osname=rhcos --remote=rhcos --url=@@OSTREE_INSTALL_URL@@ --ref=@@OSTREE_INSTALL_REF@@ @@ -42,12 +40,6 @@ reboot # https://github.com/dustymabe/ignition-dracut/pull/12 touch /boot/coreos-firstboot -# Configure docker-storage-setup to resize the partition table on boot -# https://github.com/projectatomic/docker-storage-setup/pull/25 -echo 'GROWPART=true' >> /etc/sysconfig/docker-storage-setup -# https://pagure.io/atomic-wg/issue/343 -echo 'ROOT_SIZE=+100%FREE' >> /etc/sysconfig/docker-storage-setup - # Remove any persistent NIC rules generated by udev rm -vf /etc/udev/rules.d/*persistent-net*.rules diff --git a/compose-post.sh b/compose-post.sh index e65efd29..904ab547 100755 --- a/compose-post.sh +++ b/compose-post.sh @@ -9,6 +9,38 @@ ln -sfr /usr/lib/systemd/system/{multi-user,default}.target # This is fixed in post-RHEL7 systemd ln -sf ../tmp.mount /usr/lib/systemd/system/local-fs.target.wants +# The canonical copy of this is in fedora-coreos-config. If +# making changes, please do them there first! +cat > /usr/libexec/coreos-growpart << 'EOF' +#!/bin/bash +set -euo pipefail +path=$1 +shift +majmin=$(findmnt -nvr -o MAJ:MIN $path) +devpath=$(realpath /sys/dev/block/$majmin) +partition=$(cat $devpath/partition) +parent_path=$(dirname $devpath) +parent_device=/dev/$(basename ${parent_path}) +# TODO: make this idempotent, and don't error out if +# we can't resize. +growpart ${parent_device} ${partition} || true +touch /var/lib/coreos-growpart.stamp +EOF +chmod a+x /usr/libexec/coreos-growpart +cat > /usr/lib/systemd/system/coreos-growpart.service <<'EOF' +[Unit] +ConditionPathExists=!/var/lib/coreos-growpart.stamp +Before=sshd.service +[Service] +ExecStart=/usr/libexec/coreos-growpart / +RemainAfterExit=yes +[Install] +WantedBy=multi-user.target +EOF +cat >/usr/lib/systemd/system-preset/42-coreos-growpart.preset << EOF +enable coreos-growpart.service +EOF + # The loops below are too spammy otherwise... set +x