fix: Increase maximum size for zram-resize to 4096mb

zram-generator can allocate a maximum of 4096mb
This commit is contained in:
RJ Trujillo 2023-06-24 15:26:12 -06:00
parent 19184790aa
commit 7b06c73f3e
2 changed files with 6 additions and 6 deletions

View File

@ -65,16 +65,16 @@ resize-zram:
CONFIG='/etc/systemd/zram-generator.conf'
CURRENT_SIZE=$(cat "${CONFIG}" | sed 's/zram-size=//')
echo 'Current size: '${CURRENT_SIZE}
read -p 'Enter new size (512-2048) in megabytes (1024): ' NEW_SIZE
read -p 'Enter new size (512-4096) in megabytes (1024): ' NEW_SIZE
if [ -z "${NEW_SIZE//[0-9]}" ]; then
if [ -z "${NEW_SIZE}" ]; then
NEW_SIZE=1024
fi
if ((${NEW_SIZE} >= 512 && ${NEW_SIZE} <= 2048)); then
if ((${NEW_SIZE} >= 512 && ${NEW_SIZE} <= 4096)); then
sudo sed -i 's/zram-size='${CURRENT_SIZE}'/zram-size='${NEW_SIZE}'/g' ${CONFIG}
echo 'Current size: '${NEW_SIZE}'. Please reboot.'
else
echo 'Error: Input out of range (512-2048). Running again.'
echo 'Error: Input out of range (512-4096). Running again.'
just resize-zram
fi
else

View File

@ -23,16 +23,16 @@ resize-zram:
CONFIG='/etc/systemd/zram-generator.conf'
CURRENT_SIZE=$(cat "${CONFIG}" | sed 's/zram-size=//')
echo 'Current size: '${CURRENT_SIZE}
read -p 'Enter new size (512-2048) in megabytes (1024): ' NEW_SIZE
read -p 'Enter new size (512-4096) in megabytes (1024): ' NEW_SIZE
if [ -z "${NEW_SIZE//[0-9]}" ]; then
if [ -z "${NEW_SIZE}" ]; then
NEW_SIZE=1024
fi
if ((${NEW_SIZE} >= 512 && ${NEW_SIZE} <= 2048)); then
if ((${NEW_SIZE} >= 512 && ${NEW_SIZE} <= 4096)); then
sudo sed -i 's/zram-size='${CURRENT_SIZE}'/zram-size='${NEW_SIZE}'/g' ${CONFIG}
echo 'Current size: '${NEW_SIZE}'. Please reboot.'
else
echo 'Error: Input out of range (512-2048). Running again.'
echo 'Error: Input out of range (512-4096). Running again.'
just resize-zram
fi
else