I’m going to split this question out. [and edited as my sizes were wrong]
The image is optimised for emoncms data going onto an Ext2 partition (to improve life of card). It is also an image designed for a 16Gb card.
sudo parted -l
gives more information.
Yes you can create a partition in the spare space but I’m not exactly sure how. Partly depends what you intend to add to this Pi.
If you use the scripts to install, you can amend the sizes of the resulting partitions so rootfs will be bigger.
I used the Raspbian script for expanding a new card and just added a new partition to it. Currently the start of the Ext2 partition is roughly 4 GB from the start of the card, so following the Pi preparation instruction on a 32GB card would result in a 28GB Ext2 partition. This can be used for other things but it might make more sense if it was 8-10GB from the end - I doubt emoncms data will exceed that - equally it could be an option when installing from the script.
Sadly I can’t remember why I ended up with 8960000 as the figure. I think it needed to be divisible by 1024 (Ext2 block size) so you could start again from scratch (Raspbian Lite image) and at the point where you copy the init_size script, edit the figure to be 26,880,000 as the start figure. I’m sure the rootfs will just fill the space.
@TrystanLea, it might make more sense if it was the Ext2 partition that was a fixed size from the end rather than the beginning.
Just looking at my card (an image I burned), the size of the Ext2 partition is 21268480 sectors ~10.1GB. I’ll use that.
That line I think would therefore be Card_Size - 10GB - 1 so
TARGET_END=$((ROOT_DEV_SIZE - 21268480 - 1))
@Tockley - you could try this if you like…
One other thought, there probably should be a check on card size during this process. You could run Emoncms on either a 4GB or 8GB card in reality so perhaps the init script should take account of that (future dev). Equally the documentation should state a minimum 16GB card for this image and the Scripted install (PR done).