Find out the exact size of your partition images. Flash a fresh image of the OS you were using, open the SD card in the partition manager (e.g gparted
or fdisk
), and resize partitions to match your backups. Then roll your backups back to the SD card with dd
on the partitions you have prepared (swap if
and of
in the commands you used for backup).
If you didn't keep the installation image, you can try to download it again. Assuming this is about Pi OS, the partition table is not identical between individual image releases, As Milliways points out. You can estimate the date of release you have installed using
tune2fs -l rpi_rootfs.img | grep 'Filesystem created:'