Skip to content

Commit

Permalink
runvm-osbuild: log disk usage during run
Browse files Browse the repository at this point in the history
At least temporarily let's output some logging about how much
of the filesystem under cache/ we are using so we can see if
we're getting close to limits and also maybe see which stages
are taking up the most space.
  • Loading branch information
dustymabe authored and jbtrystram committed Dec 6, 2024
1 parent 0e589f1 commit d422dc6
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/runvm-osbuild
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,17 @@ getconfig_def() {
jq -re .\""$k"\"//\""${default}"\" < "${config}"
}

log_disk_usage(){
# spawn off a subshell in the background to log disk usage every
# 10 seconds.
yellow="\033[33m"; default="\033[39m"
(while true; do
echo -e "$yellow"; df -kh ./cache; echo -e "$default";
sleep 10;
pgrep --exact osbuild >/dev/null || break;
done) &
}

while [ $# -gt 0 ];
do
flag="${1}"; shift;
Expand Down Expand Up @@ -112,6 +123,8 @@ set -x; osbuild-mpp \
"${mppyaml}" "${processed_json}"
set +x

log_disk_usage

# Build the image
set -x
# shellcheck disable=SC2068
Expand Down

0 comments on commit d422dc6

Please sign in to comment.