Skip to content

Commit

Permalink
Rework partitioning to drop LVM
Browse files Browse the repository at this point in the history
This is part of coreos/fedora-coreos-tracker#18

For now, this just drops LVM to make it easier to use Ignition
to both build images, and help enable ignition-disks.

Note that I tried to use a separate `/var` but this currently
does not work with our Ignition, which would need to learn
how to mount `/var` in the initramfs.

We add growpart logic adapted from
projectatomic/container-storage-setup@d4994e6

(Probably at some point should teach growpart how to grow based
 on mount point paths...)
  • Loading branch information
cgwalters committed Sep 14, 2018
1 parent 0fdb511 commit f98dd12
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 10 deletions.
33 changes: 32 additions & 1 deletion fedora-coreos-base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,41 @@ postprocess:
echo '%sudo ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/coreos-sudo-group
# We're not using resolved yet
rm -f /usr/lib/systemd/system/systemd-resolved.service
# https://github.com/coreos/fedora-coreos-tracker/issues/18
# See also image.ks.
# Growpart /, until we can fix Ignition for separate /var
# (And eventually we want ignition-disks)
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
[Service]
ExecStart=/usr/libexec/coreos-growpart /
RemainAfterExit=yes
Before=sshd.service
[Install]
WantedBy=multi-user.target
EOF
cat >/usr/lib/systemd/system-preset/42-coreos.preset << EOF
# Presets here that eventually should live in the generic fedora presets
# This one is from https://github.com/dustymabe/ignition-dracut
enable coreos-firstboot-complete.service
enable coreos-growpart.service
EOF
# Let's have a non-boring motd, just like CL (although theirs is more subdued
# nowadays compared to early versions with ASCII art). One thing we do here
Expand All @@ -79,7 +110,7 @@ packages:
- bridge-utils nfs-utils biosdevname iptables-services
- NetworkManager dnsmasq hostname
# Storage
- container-storage-setup cloud-utils-growpart
- cloud-utils-growpart
- lvm2 iscsi-initiator-utils sg3_utils
- device-mapper-multipath
- xfsprogs e2fsprogs mdadm
Expand Down
12 changes: 3 additions & 9 deletions image.ks
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ 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"

# https://github.com/coreos/fedora-coreos-tracker/issues/18
# See also coreos-growpart.service defined in fedora-coreos-base.yaml
part /boot --size=300 --fstype="xfs" --label=boot
part pv.01 --grow
volgroup coreos pv.01
logvol / --size=3000 --fstype="xfs" --name=root --vgname=coreos --label=root
part / --size=3000 --fstype="xfs" --label=root --grow

reboot

Expand All @@ -36,12 +36,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

0 comments on commit f98dd12

Please sign in to comment.