(This is compiled from several very helpful stackexchange posts. I spent a while figuring this out, and I don't want to lose it.)
We recently needed several identical raspbian images, all with the same libraries installed, same content in the home directory and the same setup configuration.
The obvious thing to try is to just boot a base raspbian image, set it up as you want it, then remove the card from the Pi and use another machine to copy the contents of the card to create an image, then flash that image onto the other cards you have. There are two problems with this:
- If your SD cards are large (ours were 32G), this process becomes a bit cumbersome. Flashing the cards takes longer, creating an image from the card can take a really long time, and if you have limited space on your non-pi machine, you might not have anywhere to put a 32G image.
- Even if two SD cards are nominally the same size, they might not have exactly the same amount of space. This means that if you create your image from a card