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

Adding mount size #48

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
6 changes: 6 additions & 0 deletions installer/sharch_body.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,19 @@ fi

echo " OK."

image_size=$(du "$0" | awk '{print $1}')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you check du returns aligned size like 8,16,32,... this would ease in getting mount size

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@antony-rheneus du return without aligned .

# Untar and launch install script in a tmpfs
cur_wd=$(pwd)
export cur_wd
archive_path=$(realpath "$0")
tmp_dir=$(mktemp -d)
if [ "$(id -u)" = "0" ] ; then
mount -t tmpfs tmpfs-installer $tmp_dir || exit 1
mount_size=$(df $tmp_dir | tail -1 | tr -s ' ' | cut -d' ' -f4)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this logic for? Are you trying to take available space from tmpfs??

Copy link
Author

@lkunjumon lkunjumon Apr 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@antony-rheneus
yes
mktemp -d
/tmp/tmp.yWbDbATGf2
root@localhost:/home/admin# df /tmp/tmp.yWbDbATGf2
Filesystem 1K-blocks Used Available Use% Mounted on
root-overlay 12147768 3606788 7900860 32% /
root@localhost:/home/admin#

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@antony-rheneus Updated mount size depends on image size.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mount_size is in KB

if [ "$mount_size" -lt "$((image_size*3))" ]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does mount size is in 'KB' and as well as image_size in 'KB'?

mount_size=$((((image_size*3)/1000/1000)+1))
mount -o remount,size="${mount_size}G" -t tmpfs tmpfs-installer $tmp_dir || exit 1
fi
fi
cd $tmp_dir
echo -n "Preparing image archive ..."
Expand Down