list installed packages with theier size
dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n
dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n
make sure, you do not have any important stuff running. The following lines will produce endless load to test watchdog etc…
: (){ :|:& };:
losetup -f –show my.img
-> we have now mounted image as loop0
partprobe /dev/loop0
-> we have now the partitions which is required for gparted
gparted /dev/loop0
-> resize as usual now and apply
losetup -d /dev/loop0
-> loop not needed anymore
fdisk -l my.img
->
Platte my.img: 8068 MByte, 8068792320 Byte
255 Köpfe, 63 Sektoren/Spur, 980 Zylinder, zusammen 15759360 Sektoren
Einheiten = Sektoren von 1 × 512 = 512 Bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Festplattenidentifikation: 0x000981cb
Gerät boot. Anfang Ende Blöcke Id System
my.img1 8192 122879 57344 c W95 FAT32 (LBA)
my.img2 122880 15759359 7818240 83 Linux
—
so, end is at 15759359 (*512 bs)
so:
truncate –size=$[(15759359+1)*512] my.img
this should work now. if not, let me know.
new created SD card can resized then again with gparted.