# Migrating RPi to Rock64 for idiots

**URL:** <https://help.nextcloud.com/t/migrating-rpi-to-rock64-for-idiots/53663>\
**Category:** 📦 Appliances (Docker, Snappy, VM, NCP, AIO)\
**Created:** [May 21, 2019, 8:36am UTC](https://help.nextcloud.com/t/migrating-rpi-to-rock64-for-idiots/53663 "2019-05-21T08:36:32Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![4lex](https://help.nextcloud.com/letter_avatar/4lex/32/6_22734026db12803ebb3e059622ac3534.png) [@4lex](https://help.nextcloud.com/u/4lex)\
**Post date:** [May 21, 2019, 8:36am UTC](https://help.nextcloud.com/t/migrating-rpi-to-rock64-for-idiots/53663/1 "2019-05-21T08:36:33Z")

</div>

I’m (one of) the idiot(s) in question. Possibly mostly because I embedded a nextcloudpi setup as mission critical in our small business. Anyway, I’m looking to migrate it to a Rock64 board, which arrived on the doorstep today.

I have a number of backups of the RPi implementation, complete with data. I only have about 50GB total, so I take a backup like that each week (manually because I can’t figure out how to schedule it to run @ 2300 local on a Saturday).

What I’m not sure of is what’s in that backup in terms of config, and what I must do first with the Rock64 before I attempt to restore a backup onto it? I’d be most grateful if anyone could set me straight on these.

IP address. My router keeps 192.168.1.6 for the RPi. Is the backup aware of this and does it need the new machine to also have this IP? Provided I update my port forwarding appropriately, can I keep the Pi up until the R64 is good to go, then ‘flick the switch’ such that the traffic hits 1.7 (for example) instead of 1.6?

Swapfile, database & datadir. These are all on the same physical USB 3 external drive, and I’m pretty sure I remember correctly in that it has separate partitions for them as swap, ext4 and btrfs respectively. Will restoring a backup do all or any of this for me? I realise this is more OS level stuff, but I’m quite the novice with linux. Is simply pulling this disk from the RPi setup and hanging it on the R64 far too ambitious?

Security. I’m sure my user accounts etc are all in the backup, but does it also hang on to its certificates and various security settings as may exist?

Are there questions I’m not asking that I should, and has anyone seen a ‘migrating your nextcloud from RPi to R64 explained for eight year olds’ post anywhere?

Thanks for taking the time to read.

---

<div class="post-metadata">

**Author:** ![4lex](https://help.nextcloud.com/letter_avatar/4lex/32/6_22734026db12803ebb3e059622ac3534.png) [@4lex](https://help.nextcloud.com/u/4lex)\
**Post date:** [June 7, 2019, 3:24am UTC](https://help.nextcloud.com/t/migrating-rpi-to-rock64-for-idiots/53663/2 "2019-06-07T03:24:49Z")

</div>

So fifty people read this, and no-one’s prepared to offer any kind of input. Does this mean that fifty other people want to know how this is done?

---

<div class="post-metadata">

**Author:** ![JimmyKater](https://help.nextcloud.com/user_avatar/help.nextcloud.com/jimmykater/32/4850_2.png) [@JimmyKater](https://help.nextcloud.com/u/JimmyKater)\
**Post date:** [June 7, 2019, 6:27am UTC](https://help.nextcloud.com/t/migrating-rpi-to-rock64-for-idiots/53663/3 "2019-06-07T06:27:00Z")

</div>

> [@4lex](#):
>
> Thanks for taking the time to read.

you’re welcome.

and maybe you want to search the forum first next time? as there are several hints about this…

> [@4lex](#):
>
> So fifty people read this, and no-one’s prepared to offer any kind of input.

it seems so. and yes. things like this might happen.

---

<div class="post-metadata">

**Author:** ![4lex](https://help.nextcloud.com/letter_avatar/4lex/32/6_22734026db12803ebb3e059622ac3534.png) [@4lex](https://help.nextcloud.com/u/4lex)\
**Post date:** [June 7, 2019, 6:33am UTC](https://help.nextcloud.com/t/migrating-rpi-to-rock64-for-idiots/53663/4 "2019-06-07T06:33:06Z")

</div>

Well I would contend the answer is in fact not to be found by searching, or I wouldn’t waste my time asking. Given the stated aim of the NCP project to be ‘easy for non-technical users’ or words to that effect, this is quite surprisingly the least helpful forum I’ve used, and by some margin. It up against pretty stiff competition for that coveted title too.

---

<div class="post-metadata">

**Author:** ![JimmyKater](https://help.nextcloud.com/user_avatar/help.nextcloud.com/jimmykater/32/4850_2.png) [@JimmyKater](https://help.nextcloud.com/u/JimmyKater)\
**Post date:** [June 7, 2019, 6:38am UTC](https://help.nextcloud.com/t/migrating-rpi-to-rock64-for-idiots/53663/5 "2019-06-07T06:38:04Z")

</div>

so what do you expect after your postings?

the first one showing a full disrespect of searching the forum - because i, myself, do remember having read of how to migrate from rpi to rock64 in this forum before.

and all following postings being rude?

i’m out of here. sorry.

---

<div class="post-metadata">

**Author:** ![4lex](https://help.nextcloud.com/letter_avatar/4lex/32/6_22734026db12803ebb3e059622ac3534.png) [@4lex](https://help.nextcloud.com/u/4lex)\
**Post date:** [June 7, 2019, 6:38am UTC](https://help.nextcloud.com/t/migrating-rpi-to-rock64-for-idiots/53663/6 "2019-06-07T06:38:58Z")

</div>

shush Jimmy. If you’ve nothing to add, best to add nothing.

---

<div class="post-metadata">

**Author:** ![Gee858eeG](https://help.nextcloud.com/user_avatar/help.nextcloud.com/gee858eeg/32/15746_2.png) [@Gee858eeG](https://help.nextcloud.com/u/Gee858eeG)\
**Post date:** [June 7, 2019, 3:13pm UTC](https://help.nextcloud.com/t/migrating-rpi-to-rock64-for-idiots/53663/7 "2019-06-07T15:13:10Z")

</div>

How do you perform backups? Do you follow this guide?  
[https://docs.nextcloud.com/server/16/admin\_manual/maintenance/backup.html](https://docs.nextcloud.com/server/16/admin_manual/maintenance/backup.html)

---

<div class="post-metadata">

**Author:** ![cabana](https://help.nextcloud.com/user_avatar/help.nextcloud.com/cabana/32/15776_2.png) [@cabana](https://help.nextcloud.com/u/cabana)\
**Post date:** [June 7, 2019, 5:47pm UTC](https://help.nextcloud.com/t/migrating-rpi-to-rock64-for-idiots/53663/8 "2019-06-07T17:47:01Z")

</div>

> Is the backup aware of this and does it need the new machine to also have this IP? Provided I update my port forwarding appropriately, can I keep the Pi up until the R64 is good to go, then ‘flick the switch’ such that the traffic hits 1.7 (for example) instead of 1.6?

Nextcloud does not know or care about the IP. It will have no effect on the backup. The router may assign a new IP for the Rock64, or you could set the 192.168.1.7 IP as an assigned IP for your Rock64. You would do that in the router admin page using the MAC address of your Rock64.

> Will restoring a backup do all or any of this for me? I realise this is more OS level stuff, but I’m quite the novice with linux. Is simply pulling this disk from the RPi setup and hanging it on the R64 far too ambitious?

You should not worry about OS level stuff. You should probably use a prebuilt image with nextcloud on it for your Rock64. For example one from OwnYourBIts: [https://ownyourbits.com/downloads/](https://ownyourbits.com/downloads/)  
Back up your nextcloud data/files and database normally using rsync and transfer it to the new Rock64 setup. You can find this info in the Admin manual for your nextcloud version, which should be the latest version. Follow the link from @Gee858eeG.

> Security. I’m sure my user accounts etc are all in the backup, but does it also hang on to its certificates and various security settings as may exist?

You can just get a new certificate from LetsEncrypt for your new board/domain. I would suggest backing up your RPi but keep it in service… set up your Rock64 and transfer everything to it, set the new Rock64 up on a new domain with new certs and once everything is up and running smoothly on Rock64, only then think about decommissioning the RPi.

Good luck!

---

<div class="post-metadata">

**Author:** ![4lex](https://help.nextcloud.com/letter_avatar/4lex/32/6_22734026db12803ebb3e059622ac3534.png) [@4lex](https://help.nextcloud.com/u/4lex)\
**Post date:** [June 8, 2019, 3:13am UTC](https://help.nextcloud.com/t/migrating-rpi-to-rock64-for-idiots/53663/9 "2019-06-08T03:13:44Z")

</div>

> [@Gee858eeG](#):
>
> How do you perform backups?

I’ve just been using the backup script from the admin interface, limit set to four. It generates a single .tar file of about 50GB on the local disk of the RPi NC system, which I then copy off to my windows machine using WinSCP. It’s manual, and I try to do so weekly. It’s pretty slow, so I’m sure I need to move to an rsync backup strategy and intend to cross this bridge once I’ve managed to get the R64 up.

---

<div class="post-metadata">

**Author:** ![4lex](https://help.nextcloud.com/letter_avatar/4lex/32/6_22734026db12803ebb3e059622ac3534.png) [@4lex](https://help.nextcloud.com/u/4lex)\
**Post date:** [June 8, 2019, 3:48am UTC](https://help.nextcloud.com/t/migrating-rpi-to-rock64-for-idiots/53663/10 "2019-06-08T03:48:11Z")

</div>

@Cabana - big thanks.

> [@cabana](#):
>
> Nextcloud does not know or care about the IP

OK cool, thanks. Understand how to set it.

> [@cabana](#):
>
> You should not worry about OS level stuff. You should probably use a prebuilt image with nextcloud on it for your Rock64.

Yes, I’ve managed to deploy that image to the R64. What’s causing me pain currently is the mounting of my USB disk. I’ve made four partitions and formatted them swap, EXT4 and BTRFS x2 respectively:

```auto
pi@rock64:~$ sudo fdisk -l | grep sda
Disk /dev/sda: 1.8 TiB, 2000365289472 bytes, 3906963456 sectors
/dev/sda1 2048 58595327 58593280 28G Linux filesystem
/dev/sda2 58597376 253911039 195313664 93.1G Linux filesystem
/dev/sda3 253911040 2080079871 1826168832 870.8G Linux filesystem
/dev/sda4 2080079872 3906250751 1826170880 870.8G Linux filesystem
```

I wanted to use these for swap, database, datadir and backup respectively. So I mkswap-ed /dev/sda1 which seemed to work, and I created /media/USBdisk/ and under that ncdb\_mount, nc\_datadir\_mount and nc\_backup\_mount.  
Then I went to mount my partitions thusly:

```auto
sudo mount /dev/sda3 /media/USBdisk/nc_datadir_mount
```

which seemed to work:

```auto
df | grep sda3
/dev/sda3 913084416 16896 910969600 1% /media/USBdisk/nc_datadir_mount
```

so I did others similarly and chown-ed them so they were similar to the RPi setup:

```auto
ls -l
drwxr-xr-x 1 www-data www-data 0 May 22 13:08 nc_datadir_mount
```

and then added lines to the /etc/fstab like

```auto
/dev/sda3 /media/USBdisk/nc_datadir_mount btrfs defaults 0 0 
```

I rebooted here, headed for the admin interface and asked Nextcloud to shift the datadir into this path using the script, and it tells me it doesn’t exist, which of course isn’t true. I checked nonetheless and sure as eggs is eggs it is there. Thing is, /media/blahblahblah\_usb\_disk\_identifier\_string/ is also there, and this now has a nc\_datadir\_mount in it  
I’m stuck at this part and could really use some help on mounting the partitions correctly please.  
Many thanks in advance.

---

<div class="post-metadata">

**Author:** ![4lex](https://help.nextcloud.com/letter_avatar/4lex/32/6_22734026db12803ebb3e059622ac3534.png) [@4lex](https://help.nextcloud.com/u/4lex)\
**Post date:** [June 8, 2019, 8:15am UTC](https://help.nextcloud.com/t/migrating-rpi-to-rock64-for-idiots/53663/11 "2019-06-08T08:15:34Z")

</div>

I think that maybe I was having trouble with automount competing with my fstab mounting instructions, so I flashed my image again, reformatted the USB drive partitions and re-did the mounting, and again the move DB and move datadir scripts failed and resulted in a broken instance.

Started again from scratch, and this time followed [this guide](https://help.nextcloud.com/t/howto-change-move-data-directory-after-installation/17170)

```auto
1. sudo -u www-data php /path/to/nextcloud/occ maintenance:mode --on
2. mkdir -p /new/path/to/data
3. cp -a /path/to/data/. /new/path/to/data
4. chown -R www-data:www-data /new/path/to/data
5. nano /path/to/nextcloud/config/config.php
       'datadirectory' => '/new/path/to/data',
6. mysqldump -u<rootuser> -p > /path/to/dbdump/dump.sql
7. Adjust "oc_storages"database table to reflect the new data folder location:
      mysql -u<rootuser> -p
      //enter mysql root password, then within mysql console:
      use <nextclouddb>;
      update oc_storages set id='local::/new/path/to/data/' where id='local::/path/to/data/'; //take care about backslash at the end of path!!
      quit;
8. sudo -u www-data php /path/to/nextcloud/occ maintenance:mode --off
```

to move my datadir, all good. The I used the ncp-config script to move the db, and that too went well.

So then I scp’d the most recent backup over from the pi and dropped that in my backup partition on the R64, pointed the restore script at it and crossed my fingers.

```auto
[nc-restore]
check free space...
extracting backup file /media/ncbackup_mount/nextcloud-bkp_20190608_1559962582.tar...
restore files...
restore database...
restore datadir to /media/USBdrive/ncdata...
```

Bastard. /media/USBdrive/ncdata is the datadir of the RPi instance. The R64 is /media/ncdata\_mount.

The script forged ahead anyway, made a folder called USBdrive/ncdata on the 8GB uSD card, filled it up and crashed the system.

Start again. This time I’ll make my mount point names match the RPi instance

---

<div class="post-metadata">

**Author:** ![4lex](https://help.nextcloud.com/letter_avatar/4lex/32/6_22734026db12803ebb3e059622ac3534.png) [@4lex](https://help.nextcloud.com/u/4lex)\
**Post date:** [June 8, 2019, 9:42am UTC](https://help.nextcloud.com/t/migrating-rpi-to-rock64-for-idiots/53663/12 "2019-06-08T09:42:01Z")

</div>

Aargh.  
OK, so having set it up with matching mount points I once again tried to restore:

```auto
nc-restore
check free space...
extracting backup file /media/USBdrive/ncp-backups/nextcloud-bkp_20190608_1559962582.tar...
restore files...
restore database...
backing up existing /media/USBdrive/ncdata to /media/USBdrive/ncdata-06-08-19...
mv: cannot move '/media/USBdrive/ncdata' to '/media/USBdrive/ncdata-06-08-19': Device or resource busy
Cleanup
```

☹

---

<div class="post-metadata">

**Author:** ![Gee858eeG](https://help.nextcloud.com/user_avatar/help.nextcloud.com/gee858eeg/32/15746_2.png) [@Gee858eeG](https://help.nextcloud.com/u/Gee858eeG)\
**Post date:** [June 8, 2019, 10:52am UTC](https://help.nextcloud.com/t/migrating-rpi-to-rock64-for-idiots/53663/13 "2019-06-08T10:52:38Z")

</div>

Your fstab entry:

> [@4lex](#):
>
> /dev/sda3 /media/USBdisk/nc\_datadir\_mount btrfs defaults 0 0

Your backup procedure:

> [@4lex](#):
>
> backing up existing /media/USBdrive/ncdata to /media/USBdrive/ncdata-06-08-19… mv: cannot move ‘/media/USBdrive/ncdata’ to ‘/media/USBdrive/ncdata-06-08-19’: Device or resource busy

Your hdd is mounted on `/media/USBdisk/nc_datadir` where it should be actually just mounted to `/media/USBdisk`. So your backup seems to be placed on the root of the hdd if I understand correctly (I don’t use _ncp_, so I don’t actually know how it backs up data). The backup procedure of your ncp tries to move data from your mount point of your _hdd_ which (again) is `/media/USBdisk/nc_datadir` to a new directory outside of your _hdd_. **That means it tries to move your mount point** , which of course it isn’t be allowed to do.

If you mount the hdd onto `/media/USBdisk` your backup procedure might just work… As I said, I don’t really know the backup procedure of ncp. Maybe you will have to create a folder `nc_datadir` within that drive and move your existing backup from the root of the hdd to that folder. But someone else should know better.

---

<div class="post-metadata">

**Author:** ![4lex](https://help.nextcloud.com/letter_avatar/4lex/32/6_22734026db12803ebb3e059622ac3534.png) [@4lex](https://help.nextcloud.com/u/4lex)\
**Post date:** [June 8, 2019, 1:10pm UTC](https://help.nextcloud.com/t/migrating-rpi-to-rock64-for-idiots/53663/14 "2019-06-08T13:10:29Z")

</div>

> [@Gee858eeG](#):
>
> **That means it tries to move your mount point**

Got you. I think I’d just about arrived at that conclusion myself, but thanks. I’m being tripped over by a piece of code that I actually don’t need, and I suspect I could modify with cp rather than mv and it’ll do what’s needed. That said, I don’t want a backup of the default state, so I’m going to try to work through the restore script and adapt it to discard the existing rather than back it up using mv.

---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [December 4, 2024, 9:55am UTC](https://help.nextcloud.com/t/migrating-rpi-to-rock64-for-idiots/53663/15 "2024-12-04T09:55:19Z")

</div>



---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [December 11, 2024, 3:00pm UTC](https://help.nextcloud.com/t/migrating-rpi-to-rock64-for-idiots/53663/16 "2024-12-11T15:00:26Z")

</div>


