-
Notifications
You must be signed in to change notification settings - Fork 7
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
base: master
Are you sure you want to change the base?
Changes from 14 commits
4743499
707747d
8438c34
d4f43e9
d9de9b3
98312e7
06c2388
da11766
538f077
884b169
3eca178
1d62e3f
d36f8aa
4f36d57
02227f0
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 |
---|---|---|
|
@@ -24,6 +24,10 @@ if [ "$sha1" != "$payload_sha1" ] ; then | |
fi | ||
|
||
echo " OK." | ||
#Image size in KB | ||
bytes=$((($(sed -e '1,/^exit_marker$/d' "$0" | tar --to-stdout -xf - | wc -c) + 1023 ) / 1024)) | ||
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. change variable name bytes to "image_size_in_kb" |
||
#Image size in MB | ||
image_size=$(((bytes + 1023) / 1024)) | ||
|
||
# Untar and launch install script in a tmpfs | ||
cur_wd=$(pwd) | ||
|
@@ -32,6 +36,13 @@ 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) | ||
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. What is this logic for? Are you trying to take available space from tmpfs?? 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. @antony-rheneus 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. @antony-rheneus Updated mount size depends on image size. 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. mount_size is in KB |
||
#checking extra 100KB space in tmp_dir, after image extraction | ||
padding=102400 | ||
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. write the size value, also in the comment in KBs or MBs 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. not adding, only checking extra space after extraction 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. @antony-rheneus pls review the comments 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. @antony-rheneus Please review updated commit. |
||
if [ "$mount_size" -le "$((image_size + padding))" ]; then | ||
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. comparing KB and MB |
||
mount_size=$((((image_size + 31) / 32) * 32)) | ||
mount -o remount,size="${mount_size}M" -t tmpfs tmpfs-installer $tmp_dir || exit 1 | ||
fi | ||
fi | ||
cd $tmp_dir | ||
echo -n "Preparing image archive ..." | ||
|
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.
see QiLuo's change... no need to converto to KB
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.
@antony-rheneus
Below is his comments,$(sed -e '1,/^exit_marker$ /d' "$0" | tar --to-stdout -xf - | wc -c)
Here it is dividing one time only with 1024, and mouting size in MB
bytes =
image_size=$((bytes + 1023) / 1024)
mount_size=$((image_size + 31) / 32) * 32
mount -o remount,size="${mount_size}M"