Skip to content

Conversation

@mkrizmancic
Copy link

The original backup script works great for storing the SD card contents in a disk image file. However, when I wrote the image back to the new SD card, the filesystem did not automatically expand on the first boot.

The service that runs the auto-expand script on the first boot (

create_service(){
) competed successfully, but the partition did not take up the whole 32 GB of the SD card.

I don't know exactly what seems to be the problem, but it is probably somewhere in these two lines:

backup-sh/rockpi-backup.sh

Lines 130 to 132 in 7a464e3

echo w | fdisk \$ROOT_PART
echo -e \"resizepart \$ROOT_PART_NO 100%\ny\" | parted ---pretend-input-tty \$ROOT_PART

Both commands run without errors. However, resizepart ... 100% writes the end of the current partition instead of the end of the available free space - resulting in no changes to the partition size.

I found a tool growpart from the Ubuntu package cloud-guest-utils that seems to do a better job (also reported here) and replaced the corresponding parted line with this command. The only downside of this approach is that growpart must be installed on the system that is being backed up before the backup.

My filesystem expanded automatically on the first boot without any noticeable problems. After the first boot, I removed the SD card from Rock Pi, inserted it into my computer, and ran a filesystem check in GParted. It didn't detect any errors.

Tested with:

  • SanDisk Ultra A1 32GB SD card
  • Rock Pi S, v13
  • Official Ubuntu 20.04 image

@akgnah
Copy link

akgnah commented Apr 25, 2024

Hi @mkrizmancic,

Thank you for your work.

@shawnchainw
Copy link

This would break the offline backup function and require the installation of an additional package on the system being backed up, which is unacceptable. Maybe we can take a look at how cloud-guest-utils implements it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants