diff --git a/scripts/cloudron-setup b/scripts/cloudron-setup index cc34dc5fa..35cc1e68b 100755 --- a/scripts/cloudron-setup +++ b/scripts/cloudron-setup @@ -15,7 +15,8 @@ readonly MINIMUM_MEMORY="990" # this is mostly reported for 1GB main memory # copied from cloudron-resize-fs.sh readonly physical_memory=$(free -m | awk '/Mem:/ { print $2 }') readonly disk_device="$(for d in $(find /dev -type b); do [ "$(mountpoint -d /)" = "$(mountpoint -x $d)" ] && echo $d && break; done)" -readonly disk_size_gb=$(fdisk -l ${disk_device} | grep "Disk ${disk_device}" | awk '{ printf "%.0f", $3 }') +readonly disk_size_bytes=$(fdisk -l ${disk_device} | grep "Disk ${disk_device}" | awk '{ printf "%d", $5 }') +readonly disk_size_gb=$((${disk_size_bytes}/1024/1024/1024)) # verify the system has minimum requirements met if [[ "${physical_memory}" -lt "${MINIMUM_MEMORY}" ]]; then diff --git a/setup/start/cloudron-resize-fs.sh b/setup/start/cloudron-resize-fs.sh index d0a7c1a7a..4bf770895 100755 --- a/setup/start/cloudron-resize-fs.sh +++ b/setup/start/cloudron-resize-fs.sh @@ -16,8 +16,8 @@ existing_swap=$(cat /proc/meminfo | grep SwapTotal | awk '{ printf "%.0f", $2/10 readonly physical_memory=$(free -m | awk '/Mem:/ { print $2 }') readonly swap_size=$((${physical_memory} - ${existing_swap})) # if you change this, fix enoughResourcesAvailable() in client.js readonly app_count=$((${physical_memory} / 200)) # estimated app count -readonly disk_size_gb=$(fdisk -l ${disk_device} | grep "Disk ${disk_device}" | awk '{ printf "%.0f", $3 }') -readonly disk_size=$((disk_size_gb * 1024)) +readonly disk_size_bytes=$(fdisk -l ${disk_device} | grep "Disk ${disk_device}" | awk '{ printf "%d", $5 }') # can't rely on fdisk human readable units, using bytes instead +readonly disk_size=$((${disk_size_bytes}/1024/1024)) readonly system_size=10240 # 10 gigs for system libs, apps images, installer, box code and tmp readonly ext4_reserved=$((disk_size * 5 / 100)) # this can be changes using tune2fs -m percent /dev/vda1