I am trying to follow this unfortyunately locked thread: viewtopic.php?t=300187
How does one calculate ROOT_DEV_SIZE ?
From reading the init_resize.sh I think its specified in blocks (as opposed to the usual bits). When I try reverse calculate how people calculated it, I ways get none integer results, so I know I am incorrect. Say I have a 8GB SD card, what should I set ROOT_DEV_SIZE to use 6GB, and leave 2GB free (I wish to create a separate partition).
-
- Posts: 74
- Joined: Wed Apr 14, 2021 5:47 pm
Re: init_resize.sh : How to calculate ROOT_DEV_SIZE ?
In init_resize.sh:
ROOT_DEV_SIZE is the size of the device in sectors (512 bytes each).
TARGET_END is the last sector number of the device.
If you're trying to modify init_resize.sh so that it will leave 2 GB of free space at the end of the device, make the following change:
Code: Select all
ROOT_DEV_SIZE=$(cat "/sys/block/${ROOT_DEV_NAME}/size")
TARGET_END=$((ROOT_DEV_SIZE - 1))
TARGET_END is the last sector number of the device.
If you're trying to modify init_resize.sh so that it will leave 2 GB of free space at the end of the device, make the following change:
Code: Select all
TARGET_END=$((ROOT_DEV_SIZE - 1 - ((2 * 1024 * 1024 * 1024) / 512)))