SD card upgrade and data transfer

I have balena and services installed on a 16G card. I would like to upgrade to a larger capacity card and copy the data from current card. Is that possible?

Hi @n1md4,

In order to transfer data to another card you will need a computer running Linux to access the resin-data partition.

I’ve never done this, but I think you should be able to transfer data seamlessly by:

  • Prepare the new SDCard:
    • Flash your new SD card with etcher and your balenaOS image for your device,
    • Once flashed, reinsert the old SDcard to mount it,
    • Clear the content of your new resin-data partition (delete all files and folders),
    • Delete the config.json file from the resin-boot partition (to ensure you will not mix your SDcards later),
  • Transfer the data to the new card:
    • Plug the old SD cards to your computer (with the new one still connected),
    • Copy the “config.json” file from your old resin-boot partition to the new one,
    • Copy the content of your old resin-data partition to the new one.
    • unmount all your partitions and insert your new SD card in your device.

At this point your device should boot and reconnect to your balenaCloud account with the same UUID and keep its previous data (which I suppose was your goal, otherwise just flashing the new SDCard with a new image for your fleet would have been enough).

Let us know how it goes for you :smile:

1 Like

This worked like a charm! in a real DR scenario too! n.b. one typo

Once flashed, reinsert the old SDcard to mount it

Should be the new SDcard.

There is actually an additional step. When the image is first flashed not all the SDcard space is occupied. So it requires booting once, until services are being downloaded, at that point I powered it off and deleted the new SDcard config.json and resin-data.

@n1md4,

Thanks for letting us know it mostly worked as described above, and then sharing the additional steps missing so others can do the same. Really appreciate you sharing to help others too. :slight_smile: