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
MGMT-16687: IBI use separate partition for /var/lib/containers #355
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,27 +6,42 @@ seed_image=${1:-$SEED_IMAGE} | |
seed_version=${2:-$SEED_VERSION} | ||
installation_disk=${3:-$INSTALLATION_DISK} | ||
lca_image=${4:-$LCA_IMAGE} | ||
extra_partition_start=${5:-$EXTRA_PARTITION_START} | ||
extra_partition_number=5 | ||
extra_partition_label=varlibcontainers | ||
create_extra_partition=true | ||
|
||
[[ "$extra_partition_start" == "use_directory" ]] && create_extra_partition="false" | ||
|
||
authfile=${AUTH_FILE:-"/var/tmp/backup-secret.json"} | ||
pull_secret=${PULL_SECRET_FILE:-"/var/tmp/pull-secret.json"} | ||
|
||
coreos-installer install ${installation_disk} | ||
|
||
if [[ "$create_extra_partition" == "true" ]]; then | ||
# Create new partition for /var/lib/containers | ||
sfdisk ${installation_disk} <<< write | ||
sgdisk --new $extra_partition_number:$extra_partition_start --change-name $extra_partition_number:$extra_partition_label ${installation_disk} | ||
mkfs.xfs ${installation_disk}$extra_partition_number | ||
fi | ||
|
||
|
||
# We need to grow the partition. Coreos-installer leaves a small partition | ||
growpart ${installation_disk} 4 | ||
mount ${installation_disk}4 /mnt | ||
mount ${installation_disk}3 /mnt/boot | ||
mount /dev/disk/by-partlabel/root /mnt | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps we should validate that there enough space left for the os There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This kind of check is not done anywhere while creating the seed In any case, what would be a value for "enough space left for the os" |
||
mount /dev/disk/by-partlabel/boot /mnt/boot | ||
xfs_growfs ${installation_disk}4 | ||
|
||
# Creating and mounting shared /var/lib/containers | ||
if lsattr -d /mnt/ | cut -d ' ' -f 1 | grep i; then | ||
if [[ "$create_extra_partition" == "true" ]]; then | ||
# Mount extra partition in /var/lib/containers | ||
mount /dev/disk/by-partlabel/varlibcontainers /var/lib/containers | ||
else | ||
# Create and mount directory for /var/lib/containers | ||
chattr -i /mnt/ | ||
mkdir -p /mnt/sysroot/containers | ||
mkdir -p /mnt/containers | ||
chattr +i /mnt/ | ||
else | ||
mkdir -p /mnt/sysroot/containers | ||
mount -o bind /mnt/containers /var/lib/containers | ||
fi | ||
mount -o bind /mnt/sysroot/containers /var/lib/containers | ||
|
||
additional_flags="" | ||
if [ -n "${PRECACHE_DISABLED}" ]; then | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why there's a 5 here? Should be "use directory" no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's the 5th argument from the command line in case you call the install-rhcos-and-restore-seed.sh script 😅
In the systemd unit we feed the data through env variables, but for testing it is useful :)