How to Create Small Backup Images?

The AML-S905X-CC official Raspbian-64 image distro is 1.5GB. How did you do that?

Upon flashing and first boot, the rootfs partition automatically expands to take up the entire uSD card. Presently, reasonably priced A1 cards are only available in 32 and 64 GB sizes. I bought 64GB cards. This means a base configuration Raspbian is saved as a 64 GB image. Application-specific configurations for each project are also 64GB. This is unwieldy. It consumes much storage and vast amounts of time.

RPi SD Card Copier and Bill Wilson’s rpi-clone script cannot successfully create a bootable SD card. The libretech-flash-tool does not make those cards bootable. gparted is unable to successfully resize a btrfs file system on the Libre Raspbian, and trashes the rootfs partition.

There was talk in the forums that using dd and GitHub - libre-computer-project/lift will produce a shrunken bootable image. There’s not much documentation, and I don’t understand how.

Has anyone created a small bootable image of a Libre Raspbian from a 64GB uSD card? If so, how?

  1. dd the image to a file.
  2. run lift on the file, it should minimize the file.

Currently lift does not support re-maximizing the file so you will need to deploy something on the image prior to dumping it.

Easier said than done.

First step…

  1. dd the image to a file.

I think you mean dd the uSD to an image file. Because the dd command doesn’t work on a running system, I halted the system and put the uSD in a running Ubuntu PC.

Using this command,

dd if=/dev/sdf of=~/backup.img

produced a relatively small image file. Small enough that no additional compression is necessary. Then restoring the image to another drive with,

dd if=~/backup.img of=/dev/sdf

completed without error, and the drive had two partitions that looked like the originals. Resulting uSD did not boot in the AML-S905X-CC. Boot process was going fine, but terminated with a checksum error. Here’s a picture of the crash dump.

Any ideas what might be causing this?

When using dd, use bs=1M to make it faster.

dd should create a file the same size as your MicroSD card.

Your SD card is bad since the original backup did not finish.

It wasn’t the SD card, it was the destination img file that was corrupted. I successfully ran dd and restored the image to another uSD card that booted. The dd copied the entire 64GB card including the unallocated partition. It took a long time – Save Image: 1.05 hr., Restore image: 3.52hr.

Using gparted to resize the rootfs partition destroys a bootable uSD, so that’s not an option.

The ‘lift’ script has no documentation and does not respond to ‘–help’. So guessing the syntax is:

sudo ./lift input-file output-file

The script ran for a while but did not report elapsed time. It produced an output file and threw an error. The output file was lift.input-file. The error was,

./lift: line 216: syntax error near unexpected token 'do'

The output file that lift produced, lift.input-file was 62.5GB, exactly the same size (62,537,072) as the input file.

Using the syntax ./lift input-file, I ran it again. It completed in about 1.5hr and threw the same error message,

./lift: line 216: syntax error near unexpected token 'do'

The output file was 62.5GB in size, same as it started. (Edit: 62.5 not 32.5)

I tried running lift on an image that did not have an unallocated partition. I’m still getting the error,

./lift: line 216: syntax error near unexpected token ‘do’

Any idea what that might be? I’m running this on an Ubuntu 20.04 PC.