Skip to content

Commit

Permalink
overlay: compress initrd with zstd -19 on FCOS and RHCOS/SCOS 9
Browse files Browse the repository at this point in the history
On my system, relative to gzip -9, it roughly halves decompression time at
boot while also reducing initrd size.

RHCOS 8 can't inherit this because the RHEL 8 kernel doesn't enable
CONFIG_RD_ZSTD.

This requires coreos-installer to support decoding zstd (for
`coreos-installer pxe customize`), which is
coreos/coreos-installer#920.

For coreos/fedora-coreos-tracker#1247.
  • Loading branch information
bgilbert committed Sep 16, 2022
1 parent 1f6b8b8 commit dbe16a1
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
8 changes: 8 additions & 0 deletions overlay.d/06el9/usr/lib/dracut/dracut.conf.d/coreos-zstd.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Compress initrd with zstd. dracut defaults to -15, but we want the
# maximum reasonable compression, so override the command line to use
# dracut's defaults along with -19.
#
# We can't use this in RHCOS 8 because the kernel doesn't enable
# CONFIG_RD_ZSTD.

compress="zstd -19 -q -T0"
20 changes: 20 additions & 0 deletions tests/kola/files/initrd/compression
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash
## kola:
## exclusive: false
#
# If dracut can't find the configured compressor, it warns and falls back to
# gzip (!). Fail if the initrd isn't compressed with zstd.

set -xeuo pipefail

. $KOLA_EXT_DATA/commonlib.sh

# Check initrd for zstd magic number
if is_rhcos8; then
ok "Skipping initrd zstd compression test on RHCOS 8"
else
if ! LANG=C grep -aUPq "\x28\xb5\x2f\xfd" /boot/ostree/*/init*; then
fatal "Didn't find zstd compression in initrd"
fi
ok "Found zstd compression in initrd"
fi

0 comments on commit dbe16a1

Please sign in to comment.