My SD card corrupted itself but I have a back up image.
The partition table leave 1GB unallocated space at the end so that I can restore to any 8GB memory card regardless of memory fluctuations.
The actual img file is 8GB. How can I shrink this down to ignore the extra space at the end so that I can write it onto a slightly smaller memory card?
dd
as a backup tool is a very silly idea. If you copied the whole card, you can mount the individual partitions as described here. If you just copied one partition, you can just mount the image. Either way you can then useresize2fs
(e.g.); this will leave unused space at the end of the image which you can shrink bydd
ing it out only smaller.dd
the whole card. If copying partitions you need to make sure you copy the first 512 bytes.