Moving data to a new Nextcloud server

I recently finished building a new Nextcloud server 13.0.6 running on ubuntu18.04 with nginx. Set up SSL part with letsencrypt and all is working good. Server is a Virtual machine running on vmware 6.0. I have no data on this server yet and only the admin account.

I have my existing nextcloud 13.0.6 (another vm machine on same ESX host) running on ubuntu 16.04 with apache and this is working good to. On this system I have /storage which is local space to the VM with a capacity of 15TB. This is another vdisk from the other datastore on same ESX host running vmware 6.0

Is is possible to:

  1. unmount this /storage mount from the existing vm,
  2. Shutdown this VM
  3. Remove the vdisk from vm running 16.04 and present it to the new vm running 18.04
  4. Mount it back as /storage on new VM
  5. Update data path in config.php to /storage/nextcloud/data

Something tells me no because data is owned from users that are different or non existent in the new server.

I do not have 15TB swing space to do a migration. Will this method work to move the data to the new server?

I also use Nextcloud sync from my windows PC and have a copy of all the data in another share, but hate to delete all 15TB and sync back from this share with the new server.

Any advice as to what may be an easy way to present the data from old server to new server?

Doing an in place upgrade of the OS on existing VM from 16.04 to 18.04 never worked for me and had lots of issues, plus wanted to give nginx a chance and try out so I thought is cleaner to just build a new VM and start fresh.


Might be helpfull, i realize you dont have the room to copy. But reading the manual it seems the files are the least of the issue but database and log is more important.

Yeah, thanks for the doc. I’m not moving the database over though. I will replicate the data to the new space after moving the old 15TB drive and will sync it with the three accounts that were there before. I will create the three accounts with data there and:

I will login the nexclould sync app with account1 then replicate only folders from that account. Then login with account2 and replicate the data for account 2 and same for account 3. Yes, I do have all credentials from those acocunts, all are family members.


Due to some dependencies on some users I could not proceed with the migration but now is all idle. Here is what I did and it appears to work fine so far:

  1. Because the new nextcloud server is running Ubuntu 18.04, mariadb and nginx I did not want to restore the database and other configs from old server.

  2. I had all the data replicated to another space from Nextcloud sync app running on windows desktop. I should say that this sync is per user and not a global one.

  3. Shutdown the old VM and disconnected its disk 2 (15TB) where the …/data directory was.

  4. Presented this existing vdisk to new VM running Nextcloud.
    On new server I did:
    a. created a directory called /storage
    b. Adjusted /etc/fstab to mount it on boot time as etx4 with defaults.
    c. Modified /usr/share/nginx/nextcloud/config/config.php and changed the data path to /storage/nextcloud/data
    d. Rebooted the VM to make sure all is functional and login works fine for the admin account.
    So far so good.

  5. Created a user in the new server with same disk quota it had in the old server. Because I created it with same username it did not create a directory under /storage/nextcloud/data It carried over the existing username that was there. I did this test where I created a new directory from web interface and I did see that under /storage/nextcloud/data/username/files path… Other existing data though was not visible on web interface after I logged in with same username and password I had and this was expected because the database is not restored and those entries are missing. What I did was I deleted back the user I created in the admin section and this action took away the username directory from the …/data/username ( I did not do rm -rf username/ from cli) thought If the admin interface will remove it it is cleaner that way.

I re-created back the user and now the timestamp on directory …/data/username has the matching time and date that was same as when I created this user. After doing so I logged in as the new user I just created on Nextcloud sync app pointing to new server and synced with old directory where I had the data. (Made sure to pick the option to “leave the data on disk” so it will do a reverse sync and copy the data from Nextcoud sync repository to …/data/username/files

It is still syncing and so far 640GB are copied back and all accessible from Nextcloud front end web interface.

Imported back calendar file and contacts i had saved from the old server and all looks good.

I’m running Nextcloud 13.0.6 using Bionic, 18.04LTS, nginx and mariadb.

Next challenge is to upgrade all this to Nextcloud 14… Yes, will take a snapshot first before I proceed. It has saved me tons of time in troubleshooting issues. Another good reason for running this as a VM.