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

Misc image tool script improvements #264

Merged
merged 1 commit into from
Mar 18, 2024
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
2 changes: 1 addition & 1 deletion tools/bin/capture-docker-stack
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ DOCKER_IMAGE_VERSION=$(docker inspect "${DOCKER_IMAGE}" | jq .[].Id | cut -d ':'
# The `--user root` is required since the images for newer stacks default to a non-root user.
DOCKER_IMAGE_SIZE_IN_MB=$(docker run --rm --platform linux/amd64 --user root "${DOCKER_IMAGE}" du -sx --block-size=M | cut -d 'M' -f 1)

IMG_BASE=${STACK_NAME}64-$STACK_VERSION-$DOCKER_IMAGE_VERSION
IMG_BASE=${STACK_NAME}-$STACK_VERSION-$DOCKER_IMAGE_VERSION
IMG=/tmp/$IMG_BASE.img
IMG_MNT=/tmp/$IMG_BASE
IMG_GZ=/tmp/$IMG_BASE.img.gz
Expand Down
8 changes: 8 additions & 0 deletions tools/bin/make-filesystem-image
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,13 @@ mkdir -p "$(dirname "$IMG")"
# https://unix.stackexchange.com/a/121888
fallocate --length "${IMG_SIZE_IN_MB}MiB" "${IMG}"

# Format that file as an ext3 filesystem.
# The `-m` argument reduces reserved-blocks-percentage from its default of 5% to 1%.
# TODO: Switch to calling `mkfs.ext3` or `mke2fs -t ext3` since the `mkfs` alias is deprecated:
# https://manpages.ubuntu.com/manpages/jammy/en/man8/mkfs.8.html
mkfs -t ext3 -m 1 "$IMG"

# Adjust the filesystem parameters for improved performance on runtime instances.
# The `-c` and `-i` arguments disable automatic filesystem checks, which are otherwise run based
# on number of times the image is mounted, or how much time has passed since the last check.
tune2fs -c 0 -i 0 "$IMG"