So now having done a bit of testing on the Nextcloud data migration, here are my notes FWIW. I haven’t found any specific instructions on doing this, so the odds are good I’m missing something.
My intent is to migrate from my SME Server. I installed Owncloud 7, IIRC, on that machine, upgraded through the latest version before the Nextcloud fork, migrated to Nextcloud, and have upgraded that progressively up to the latest version. No doubt there’s a lot of legacy cruft in there. That also means that it’s still running on a database named owncloud
. I’m not testing using my main machine (that would be insanity), but my testing environment is trying to somewhat duplicate this.
So, I set up two test VMs. One running SME 9.2, one running Neth 7.4. On the SME VM, I created a half-dozen users, installed Nextcloud 12.0.3 (using a database named owncloud
–which will turn out to be very helpful), and uploaded some data to those users’ directories. Also on that server, I logged into Nextcloud as the admin user, and went to the Users page–that lists all the usernames along with their corresponding UUIDs. Those got copied into a spreadsheet.
On the Neth VM, I set it up as its own domain controller (something I hadn’t realized when I started this thread that I would need to do if I wanted to authenticate SMB access), and installed most of the packages I wanted from the software center–backup, email, file server, mysql server, web server, etc. I did not install Roundcube or Nextcloud at this time, because their database users get clobbered in the migration from SME.
I migrated the data from the SME server using the rsync-migrate
script. Once that finished, I installed Nextcloud and Roundcube from the software center. Also installed phpMyAdmin and mc.
I logged into Nextcloud on the Neth VM using admin/Nethesis,1234, went to the Users page, and got the new list of usernames and UUIDs. Copied those to the spreadsheet too.
Now all the pieces were in place. Using mc
, I moved the data directories from /var/lib/nethserver/ibay/owncloud/html/data
to /var/lib/nethserver/nextcloud
, renaming them from the old UUIDs to the new ones in the process. Then fired up phpMyAdmin.
In the owncloud
database (i.e., the old one), I went into the oc_activity
table. One at a time, I replaced the old UUIDs with the new ones on both the user
column and the affecteduser
column. The oc_files_trash
table was empty; if not, I should have done the same there. I then copied the oc_activity
and oc_filecache
tables into the nextcloud
database, replacing the existing tables there.
The result is that I’m able to log into Nextcloud on the Neth VM as any of the users I set up on the SME VM, and the files I uploaded to those users’ Nextcloud folders on the SME VM are now available through Nextcloud on the Neth VM. I’m provisionally considering this successful.
What I’m not sure of is whether I should be copying data in any other tables into the nextcloud database. Thus far, my inquires on the Nextcloud forums have not gotten any answers.
Edit: Well, I think I’ve found one other table. In the oc_share
table, the same find/replace would be needed in uid_owner
and share_with
. Wasn’t an issue on my test install as I hadn’t shared anything.
Also in oc_share_external
, the user
column should be updated. Looks like the same is needed for the oc_uid
column in both oc_storagecharts2
and oc_storagecharts2_uconf
.