Page 1 of 1

Reduce SD Card Partition for backup

Posted: Sat Jun 30, 2018 5:44 pm
by vvarrior
I bought a 64 GB SD card for my RPi Zero with the idea of more space to save images. I've been developing on it for a month or so and when I went to make a backup of it, I realized I may have screwed up. My external drive is 150 GB that I use to back stuff up on so 7 GB backups are ok. 64 GB backups, however, are not.

If there is a way to reduce the partition and create a secondary partition on the SD card without redoing all of the setup, could someone give me some insight?

Re: Reduce SD Card Partition for backup

Posted: Sat Jun 30, 2018 5:52 pm
by Ronaldlees
I don't think partition shrinking is in the cards. The shrinker would need to move all of your files within the partition, before it could shrink. I think Windows is equipped to do this, but most OSS systems probably not. There are utilities to shrink *file systems* in LInux, but I haven't used them.

Do you really need to save the entire disk image? Perhaps make a set of directories that are always where you put stuff, and make tarball archives of those ...

Re: Reduce SD Card Partition for backup

Posted: Sat Jun 30, 2018 5:55 pm
by vvarrior
I tried to delete the topic but you replied faster than I could get to it. I did a search (something I should have done prior to posting) and found this topic: viewtopic.php?t=60161

I believe it might be better for me to just start from scratch and move everything over. Ah well, a day lost.

Re: Reduce SD Card Partition for backup

Posted: Sat Jun 30, 2018 6:01 pm
by Ronaldlees
vvarrior wrote:
Sat Jun 30, 2018 5:55 pm
I tried to delete the topic but you replied faster than I could get to it. I did a search (something I should have done prior to posting) and found this topic: viewtopic.php?t=60161

I believe it might be better for me to just start from scratch and move everything over. Ah well, a day lost.
I'd agree. The whole "shrinking" process seems to me to be living on the edge.

Re: Reduce SD Card Partition for backup

Posted: Sat Jun 30, 2018 6:11 pm
by DirkS
Maybe you can use rsync. It will only copy the files, not the empty space.
https://www.raspberrypi.org/documentati ... h/rsync.md

Re: Reduce SD Card Partition for backup

Posted: Sat Jun 30, 2018 6:51 pm
by vvarrior
Since I'm starting from scratch, the img file for Stretch lite is only 1.8 GB. When I use etcher to burn the image, the second partition expands to fill the sd card. This is a problem for making image copies of the sd card for both backup and creating duplicate pis...

Does anyone use deja dup like this article suggests (https://www.raspberrypi.org/magpi/back-up-raspberry-pi/)?

Re: Reduce SD Card Partition for backup

Posted: Sat Jun 30, 2018 7:06 pm
by fbe
vvarrior wrote:
Sat Jun 30, 2018 6:51 pm
When I use etcher to burn the image, the second partition expands to fill the sd card. This is a problem for making image copies of the sd card for both backup and creating duplicate pis...
Remove "init=/usr/lib/raspi-config/init_resize.sh" from cmdline.txt on the first partition, if it's a problem for you.

Re: Reduce SD Card Partition for backup

Posted: Sat Jun 30, 2018 7:07 pm
by vvarrior
Is there a way to choose how big its resized to?