I have raspbian setup and configured ready to replicate to other pi's. The source sd is a 16GB memory card but only 5GB is used. When I use win32 image to backup, it images the whole 16GB. How do I image just the 5GB so I can buy the cheaper 8gb cards rather than 16gbs?


bumped to the homepage by Community 2 days ago

This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.


First: What Win32diskimager does is creating a bit-to-bit copy of the SD card. This means it copies every bit, even if it stores no data.

There are several tutorials how to to that on a Linux machine, like this one https://raspberrypi.stackexchange.com/a/56312/71377

Furthermore there are automatized scripts to to that on Linux, e.g. https://github.com/qrti/shrink.

I don't know a way to handle this problem on Windows (which you seem to be using) properly. I would recommend you using a Linux VM (virtual machine) or Linux live system which can be booted from a USB stick.

To do so, download e.g. a Ubuntu image from here. Copy it to a USB stick the way you copied Raspbian to your SD card using Win32DiskImager. Boot your PC from this USB stick and click on "Try Ubuntu". Now you have a working Linux environment which can be used to shricńk the image following the guides I linked above.


Short answer: buy an 8GB SD card and use that as your source.

You can then copy the 8GB .img file 8GB or other larger SD cards. Incidentally when you first boot from the larger SD card, Raspbian automagically expands to use all the card.

I also found that 8GB microSD cards are becoming scarce, so I picked up a couple now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.