Best Practice for Migrating NextCloudPi to a new Pi with new SD Card and new USB-Sticks

Hello,

currently, I have a Raspberry Pi 2B with an older version of NCP on the SD card. The SD card got broken but I have a backup of the data on a USB stick (Backup of NCP and data files). I have another USB stick with the data files on it. Now, I want to buy a new Raspberry Pi 4 (4GB), a new SD card and two new USB sticks to increase storage space.

My current plan would look like this:

  1. Flash new SD card with the newest image of NCP
  2. Boot the new Pi with the new SD card
  3. Restore the backup of the ncp instance of the backup USB stick to the new SD card
  4. Copy the content from the data USB stick to the new data USB stick
  5. Copy the content of the backup USB stick to the new backup USB stick
  6. Update the NCP instance to the newest version

I don’t know yet how to perform steps 4 and 5 properly. I would firstly format the new USB sticks to BTRFS format (the format of the old sticks). Then I could simply copy the content of the old stick to the new stick with the cp-command, I guess.

Is this the way to go? What procedure would you recommend?

You must differ between your files (on the file-system under …/data) and all configuration (users, shares, contacts, …) in the MariaDB. Perhaps you do only use a few shares and you can easy re-create them (10 minutes, one hour, …).

If yes:

  • buy a new pi, new sd-card, new usb-stick
  • install the newest NextcloudPi (e.g. use BTRFS)
  • add your user/users in the new empty nextcloud
  • copy only the files (…/data/user/files) from OLD to NEW
  • use “… php occ files:scan --all” (perhaps it differ on NCP) to recan all new files
  • re-create all shares, contacts, … (they are all lost)
  • make a new backup

If no:

I think it is also possible to restore it on a new system. The problem is the release. Perhaps you must use the old release and update all releases. In my version you have only the newest version without upgraded version.

What version ncp are you using?

Raspberry Pi is not the only, nor the best choice for running NC, depending budget, there are alternatives.

Since you are using btrfs snapshots, you can still follow the steps in docs to backup and restore (without data) using ncp-config, or use ncp-web:4443 .
Migrating to new hardware is basically same thing as restoring to old one.

If you need to update NC, dont skip major versions, from 16 go 17, then to 18.

I did it like you proposed under “yes”. Thank you. I think, it was a better idea to make a fresh install instead of restoring the old NC instance.

1 Like