ok
take the deot_v1+ 191111.img as example
First use https://github.com/Drewsif/PiShrink to do a simple shrink
sudo pishrink.sh -s deot_v1+\ 191111.img
that will shrink your image to be like 6.8G ,don’t forget the -s , without -s, it will add raspberrypi’s auto_expand into the /etc/rc.local
then follow the instructions https://gist.github.com/cuu/b11109f2197cd482fe8d2c61b8d409c6
to add the expander into the img
sudo mount -o loop,offset=48234496 deot_v1+\ 191111.img /media/sdb2/
cd /media/sdb2/etc/init.d
sudo wget https://gist.githubusercontent.com/cuu/b11109f2197cd482fe8d2c61b8d409c6/raw/672971991633283eaf8cdc0263a99472371b508d/expand_rootfs
sudo chmod +x expand_rootfs
cd ../rc3.d/
sudo ln -s ../init.d/expand_rootfs S01expand_rootfs
cd && sudo umount /media/sdb2
last is little bit complex
use losetup to setup the img to a loop device, then dd a zero file to fill the unused space with zero and delete it in the last
here is what I did
sudo mkdir /mnt/p2
sudo losetup -P /dev/loop21 deot_v1+\ 191111.img
sudo mount /dev/loop21p2 /mnt/p2/
sudo dd if=/dev/zero of=/mnt/p2/zero
sudo rm /mnt/p2/zero
sudo umount /mnt/p2/
sudo losetup -d /dev/loop21
under your /dev ,there are a lot of loop devices, like loop1 loop2…
just find loop+number not existed under /dev, in my computer , I choose loop21
the /mnt/p2 is a mount folder I create for mounting, you can chose whatever the name you want
just make sure it’s an empty folder, same as the /media/sdb2 above
PS
it took 6 hours to download your image here, so your network is fast