Posts: 62
Joined: Mon May 19, 2014 3:47 pm

Re: Cannot resize Raspbian Stretch lite images with Parted

Thu Sep 14, 2017 3:22 pm

pi-anazazi wrote: ... unbelievable thread here. As fruity pointed out in the very beginning: Use piclone, it resized to whichever size you want. In just 5 minutes you're done.
fruitoftheloom suggested using SD Card Copier "to back up to another SD Card in a USB SDHC Card Reader". It only runs in the GUI version of Raspbian.

piclone appears to be the command line version of SD Card Copier... https://github.com/raspberrypi-ui/piclo ... src/backup piclone doesn't "resize(d) to whichever size you want". It clones a running SD card onto another SD card. The resulting size of the clone is determined by the size of the destination disk which it occupies the entirety of and you have no choice over that.

Neither satisfy my use case, which I made clear from the start, I am using headless Raspbian and my goal is to create a backup image file, in which the size of the image file is minimized with regard to how much space is occupied by the root file system. I will store these backups on a drive somewhere along with several others and optionally flash them to an SD card at some future point in time.


Posts: 317
Joined: Wed Dec 14, 2011 3:59 pm
Location: Wirral, UK

Re: Cannot resize Raspbian Stretch lite images with Parted

Mon Oct 23, 2017 3:52 pm

FlexMcMurphy wrote:
Sun Sep 10, 2017 7:00 pm

Code: Select all

dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
==== I made a change to my /etc/fstab to look like this but no joy...

Code: Select all

proc            /proc           proc    defaults          0       0
/dev/mmcblk0p1  /boot           vfat    defaults          0       2
/dev/mmcblk0p2  /               ext4    defaults,noatime  0       1
# a swapfile is not a swap partition, no line here
#   use  dphys-swapfile swap[on|off]  for that
For the record I was having the same issue after resizing using the pishrink script on github. After I mounted the images and made these changes it worked.

Posts: 2
Joined: Mon Mar 16, 2015 9:54 pm

Re: Cannot resize Raspbian Stretch lite images with Parted

Wed Aug 22, 2018 8:17 pm

I was attempting to use your image-backup script RonR and got the error below. I tried multiple sizes and got the same error, I am attempting to write the image onto a 16GB SD card. Any help you could offer? It could be very useful to me if I can get it working.

Code: Select all

sudo /usr/local/bin/image-backup

Image file to create? /media/pi/0403-0201/CPIServer.img

Image ROOT filesystem size (MB) [15146]? 0

Requested image ROOT filesystem size (0) is too small (Minimum = 5454)

Image ROOT filesystem size (MB) [15146]? 5600

Create /media/pi/0403-0201/CPIServer.img [5600 MB] (y/n)? y
truncate: failed to truncate '/media/pi/0403-0201/CPIServer.img' at 5917114368 bytes: File too large

Posts: 289
Joined: Tue Apr 12, 2016 10:29 pm
Location: US

Re: Cannot resize Raspbian Stretch lite images with Parted

Thu Aug 23, 2018 12:10 am

My guess is there isn't 5.6 GB of space left on the destination SD card or it is formatted vfat which can't create a file larger than 2 GB.

Posts: 2
Joined: Thu May 04, 2017 7:44 pm

Re: Cannot resize Raspbian Stretch lite images with Parted

Thu Oct 04, 2018 9:29 pm

Thanks, for everybody who shared information on this topic, for my particular use case, I have a couple of Pis, a Pi 3 Model B, and a B+. That said, I ran into several outdated guides. Mostly went through the adafruit guide several times following the PDF and the HTML version, neither of which worked properly due to the new Raspbian images using the new UUID scheme, which we all pretty much know at this point bork the boot process when resizing partitions using a partition tool because from what I can tell the UUID is modified, and I guess the bootloader used for Raspbian can not find the partitions because the UUID's for the corresponding files have not been updated.

I successfully updated the boot partition on a Raspbian Stretch image 2018-06-27-raspbian-stretch.img that I flashed to an micro SD card to 1GB in size so I can experiment with building custom Linux kernels for various hardware I will be messing around with the Pis.

After sifting through all the instructions in this thread, I put together a very crude guide for the steps that worked for me. It is not a complete exhaustive guide but does perform / outline steps required to get a 1GB boot partition going on a Raspbian OS micro SD card.

https://github.com/ipatch/dotfiles/wiki ... g-raspbian

cheers 🍻

Posts: 289
Joined: Tue Apr 12, 2016 10:29 pm
Location: US

Re: Cannot resize Raspbian Stretch lite images with Parted

Sun Jul 14, 2019 2:59 am

RonR wrote:
Tue Sep 12, 2017 11:57 pm
The attached image-backup will create a backup of the running SD card to a standard 'raw' image file that can be written to a new SD card with etcher, imageUSB, etc. It will also do incremental updates to the backup image.

Running image-backup with no parameters will create a full backup. To create the smallest image, specify an image size of 0 to determine the minimum size. If you plan to incrementally update it, use a considerably larger size to allow for additional growth. Do NOT create the backup image file on the running SD card (use a flash drive or Windows share for the destination).

Running image-backup with a parameter of an existing image filename will incrementally update that image file.

I run a cron job that does an incremental update at 4 am daily so I've always got a current backup.
Updated image-backup to accommodate larger BOOT partition used on Raspbian Buster.
(2.25 KiB) Downloaded 2 times

Return to “Raspbian”