0

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?

Thanks

1
  • Read this, and especially this. It won't help you now because the decompress will need a 16GB card... but at least you'll know.
    – Seamus
    Commented Feb 11, 2020 at 21:38

3 Answers 3

1

You can create an empty image file of any size you want. It has empty formatted partitions, one fat32 boot partition and one ext4 root partition. But you are free to create partitions as much as you like and format them as you like. Then you can mount the empty partitions and the partitions of your source SD Card and copy its files to the new image as long as all files fit into the partitions of the new image. When finished you can just flash the new (smaller?) image to an SD Card. How to use it, look at How to make an image file from scratch.

0

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.

0

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.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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