Skip to content
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

Drop LVM, use custom growpart wrapper #294

Merged
Merged
Show file tree
Hide file tree
Changes from all 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
12 changes: 2 additions & 10 deletions cloud.ks
Original file line number Diff line number Diff line change
Expand Up @@ -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@@

Expand All @@ -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

Expand Down
32 changes: 32 additions & 0 deletions compose-post.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down