Correct calculation of swap file size

This commit is contained in:
Price Hiller 2021-11-25 04:27:39 -06:00
parent e7c61d3c20
commit 5b8975f6c8

View File

@ -243,9 +243,9 @@ install() {
sfdisk --delete "${install_path}" >/dev/null
log "info" "Wiped partitions on $(important "${install_disk}")"
log "info" "Securely erasing remaining data on $(important "${install_disk}")"
# echo YES | cryptsetup open --type plain -d /dev/urandom "${install_path}" to_be_wiped > /dev/null
echo YES | cryptsetup open --type plain -d /dev/urandom "${install_path}" to_be_wiped > /dev/null
# dd bs=1M if=/dev/zero of=/dev/mapper/to_be_wiped status=progress 2> /dev/null
# cryptsetup close to_be_wiped
cryptsetup close to_be_wiped
log "info" "Writing new partitions to $(important "${install_disk}")"
(echo n
echo
@ -273,7 +273,7 @@ install() {
mount "${install_path}" /mnt/boot
local mem_amount
mem_amount="$(grep MemTotal /proc/meminfo | tr -s " " | cut -d " " -f2)"
mem_amount=$(( mem_amount * 3/2 ))
mem_amount=$(( mem_amount * 3/2 / 1000 ))
log "info" "Creating swap file with memory amount: $(important "${mem_amount}") mebibytes"
dd if=/dev/zero of=/mnt/swapfile bs=1M count="${mem_amount}" status=progress
chmod 600 /mnt/swapfile