PabloS83
Posts: 9
Joined: Mon Apr 27, 2020 2:07 pm

SD card backup + increasing SD card size

Mon Apr 27, 2020 2:45 pm

I just setup my first Pi 4 kit but not doing anything with it at the moment. I plan on using it as a Unifi controller at some point but have concerns about backing up the SD and what to do about upgrading the SD card in case of failure or just wanting to increase size.

I’ve seen I can use Win32 Disk Image to create a .img file from another PC that has the micro SD card inserted which can be my backup if I decide to go that route but what happens if I want to upgrade the SD card size to 64GB or even higher? Can I restore that .img from the 32GB card to the 64GB card and then extend the partitions using gparted?

User avatar
Botspot
Posts: 1262
Joined: Thu Jan 17, 2019 9:47 pm
Location: Texas
Contact: Website

Re: SD card backup + increasing SD card size

Mon Apr 27, 2020 5:37 pm

PabloS83 wrote:
Mon Apr 27, 2020 2:45 pm
what happens if I want to upgrade the SD card size to 64GB or even higher? Can I restore that .img from the 32GB card to the 64GB card and then extend the partitions using gparted?
As long as the img is smaller than the destination card, you will be fine. So in your case, a 32GB .img will restore perfectly to a 64GB one. Next time you boot your Pi, the partiton will resize automatically. (so no need to mess with gparted)

But if you want to downgrade (if the img is larger than the card), it takes a bit more work: Let's say you have a 32GB .img, and you want to put it on a 16GB card.
Obviously, it won't fit. You will have to shrink the img. How does that work, is it like compression? Not exactly. Shrinking an img means you remove all of its free space.
I guess you could compare it to sizing down a cardboard box until all the extra unnecessary space is gone.
If the resulting img is <16GB, then you can now flash it to a 16GB card.

Speaking of shrinking: Pi Power Tools is a little program I made, that lets you customize your own Raspbian img. One of its features is a shrinking utility.
Screenshot: (see the Shrink button)
img-mode.png
img-mode.png (21.47 KiB) Viewed 135 times
I've developed the most intuitive RaspiOS img editor on the planet.
With a GUI similar to Gparted, managing imgs and sd cards is a breeze!
Boot it in a VM, Flash from the Internet at top speed, Mount (to drop in files), Shrink/Expand, Repair, and more.
https://github.com/Botspot/Pi-Power-Tools
> 400 users! 8-)

PabloS83
Posts: 9
Joined: Mon Apr 27, 2020 2:07 pm

Re: SD card backup + increasing SD card size

Mon Apr 27, 2020 7:57 pm

Wow, that's great to know. I don't think I'll ever go down in size FYI, only up. I didn't know it would resize automatically. That's pretty cool.

I appreciate the info!

Return to “General discussion”