1

I am trying to make a backup of my raspian image, so I can distribute it to more Raspberrys in the future. I used dd for that, but as my sd card is larger then the image, I ended up with a 16 Gb file instead of 4.5.

I found several instructions on how to shrink this, like http://www.instructables.com/id/How-to-BackUp-and-Shrink-Your-Raspberry-Pi-Image/ or the pishrink.sh script. But these instructions all produce images which are substantially larger than needed (~6.5 Gb). This seems to be the case because resize2fs is miscalculating the minimum size.

How can I produce an image which has the optimal size?

Mike Poole
  • 222
  • 1
  • 2
  • 7
  • So is the minimum size GParted calculated 6.4GiB, and could you add a screenshot of GParted please? – Wilf Sep 23 '17 at 10:11
  • 1
    No. Gparted calculated 4.5 but if I set it to 4.5 and try to apply it in gparted, gparted stops with an error and the error message says, that this is higher than the minimum size reported by resize2fs – numberCruncher Sep 23 '17 at 10:13
  • If you want to produce an optimal image you need to approach this from a different perspective. Think months of effort; you can find details of how Raspbian images are made if you want to follow this approach. Shrinking a working image will never approach this, because this contains a lot of cruft, which will be regenerated. The simplest approach which stands a chance of success is to generate an image file (of the appropriate size) and use rsync to copy the relevant parts of the working image. – Milliways Sep 23 '17 at 10:21
  • 1
    This can be automated, but AFAIK there is no existing script to do this. can-a-raspberry-pi-be-used-to-create-a-backup-of-itself should provide a starting point – Milliways Sep 23 '17 at 10:24
  • This is one reason dd is a lousy backup tool. That's not its intended purpose. – goldilocks Sep 23 '17 at 12:42

0 Answers0