vvarrior
Posts: 89
Joined: Fri Jan 02, 2015 3:03 am

Reduce SD Card Partition for backup

Sat Jun 30, 2018 5:44 pm

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?

User avatar
Ronaldlees
Posts: 294
Joined: Sat Apr 16, 2016 4:28 pm
Location: North Carolina, US
Contact: Website

Re: Reduce SD Card Partition for backup

Sat Jun 30, 2018 5:52 pm

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 ...
Last edited by Ronaldlees on Sat Jun 30, 2018 5:57 pm, edited 1 time in total.
I am the Umbrella man

vvarrior
Posts: 89
Joined: Fri Jan 02, 2015 3:03 am

Re: Reduce SD Card Partition for backup

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.

User avatar
Ronaldlees
Posts: 294
Joined: Sat Apr 16, 2016 4:28 pm
Location: North Carolina, US
Contact: Website

Re: Reduce SD Card Partition for backup

Sat Jun 30, 2018 6:01 pm

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.
I am the Umbrella man

DirkS
Posts: 9838
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Reduce SD Card Partition for backup

Sat Jun 30, 2018 6:11 pm

Maybe you can use rsync. It will only copy the files, not the empty space.
https://www.raspberrypi.org/documentati ... h/rsync.md

vvarrior
Posts: 89
Joined: Fri Jan 02, 2015 3:03 am

Re: Reduce SD Card Partition for backup

Sat Jun 30, 2018 6:51 pm

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/)?

fbe
Posts: 464
Joined: Thu Aug 17, 2017 9:08 pm

Re: Reduce SD Card Partition for backup

Sat Jun 30, 2018 7:06 pm

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.

vvarrior
Posts: 89
Joined: Fri Jan 02, 2015 3:03 am

Re: Reduce SD Card Partition for backup

Sat Jun 30, 2018 7:07 pm

Is there a way to choose how big its resized to?

Return to “Beginners”