Arcade Punks – Arcade, Building, Modding and Gaming Forum

You need to log in to create posts and topics.

Suggestion for image builders: Resizing

Heya All, first time using the arcadepunks resources, and I like what I've found so far.  The issue I'm bringing up is that I've seen several threads with folks that can't fit the downloaded image onto the card they bought, due to minor sizes between brands.  I'm working with the VertiPie image myself, getting ready to do a cab build, and after writing it 3 or 4 times on my MacBook, with minor config changes, deleting the image and re-extracting it to make sure it wasn't corrupt, and finally giving up and switching to a Linux VM, I got the "No Space Left On Device" error.

Since I'm a "linux guy" by trade, I decided that rather than buy a bigger SD card, I'd look to see how much I could shave off of the image.  I mounted it and found that it only has 21GB of used space!  I downloaded an extra 10+GB of nothing!  To top it off, because of that, it wouldn't fit on my card.

So my tl;dr is, for maximum usability, and to save time and bandwidth, I am suggesting to image builders the following:

  • resize2fs the main / partition down to used space +2GB
  • add the following to the /boot/cmdline.txt so it auto-resizes on first boot for new users:
    init=/usr/lib/raspi-config/init_resize.sh
    
  • truncate the image file past the final block of the new filesystem size:
    fdisk -l (to find the Last Block for the partition)
    truncate -s $(((LASTBLOCK+1)*512))

This will make much smaller image files to deal with, and will make it so everyone's SD cards work!

Thanks for listening to my little rant.

pishrink is a really good way to setup an image as well. it shrinks your fullsize image to only what is being used up, then upon first boot, will resize your filesystem to match your sd card.