I am using Raspberry OS for a batch of zeros, I wanted to prepare the OS one time and then flash the prepared image for the others. After flashing the OS I installed some useful things for later, I inserted the SD in the computer, I resized to the minimum size the rootfs partition with gparted and I created an img file. To re-expand the partition I readded into
init=/usr/lib/raspi-config/init_resize.sh, when I boot the raspberry but nothing happens, the partition is always little and the string in cmdline is removed like it should after the operation. How can I auto-expand the partition at the boot? I am using latest Raspberry OS, April '22 release. All I found is a bunch of answers really old that I don't think they fit anymore and to add that line as I described.
To create the custom image I am doing
sudo dd if=/dev/sdb of=pi.img bs=1M count=4500 and then use a script I found pishrink. However the method doesn't work even if I flash the base image, I start the raspberry, I resize back the image, I add the line and plug in it again.
Since it was asked, this is the SD card before shrinking:
Disk /dev/sdb: 14,84 GiB, 15931539456 bytes, 31116288 sectors Disk model: Transcend Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x1a66848a Device Boot Start End Sectors Size Id Type /dev/sdb1 8192 532479 524288 256M c W95 FAT32 (LBA) /dev/sdb2 532480 31115263 30582784 14,6G 83 Linux