0

I have a question about to the migration of data to a new nextcloud installation. I have a one node google’s Ganeti cluster with multiple VM’s, nextcloud and the backup VM’s are the only VM’s with external data storage. The Ganeti master (host) and all VM’s run Ubutuntu 16.04.

  • For nextcloud I have a raid 5 attached over nfs from the host (Ganeti) to the guest (nextcloud) with 2TB of data
  • I am using samba 4 AD to manage user’s accounts
  • the user’s folder in the data directory is the UUID of the users

Now I want to move from Ubuntu to debian for the Ganeti master (host) as well as for the VM’s (guests). That means I have to delete every thing, keep the existing raid and reinstall host and guests. So when setting up a new samba 4 AD and create the users again, they will have a different UUID. My current samba version is 4.3.11-Ubuntu, so I cannot run the backup samba-tool domain backup offline --targetdir=/backup-dir

Is there any way to migrate the data of the existing accounts to the new accounts with the new UUID? Or maybe remapping the existing UUID to the CN?

I found out that UUID's of the users which are the home directories of them are stored in mysql data base.

I already asked this question in nextcloud community but no answer yet.

Thanks in advanced

Max
  • 143
  • 1
  • 6

1 Answers1

0

After moving to Debian I decided to move from mysql-5.7 to mariadb-server 10.1.37-0+deb9u1, from the default stretch repo. So I did the following:

  1. installed alll needed packages from default debian pero which are needed for nextcloud
  2. created my nextcloud vhost
  3. copied the /var/www/nextcloud/directory to the new server
  4. made an sqldump from the old server and copied it to the new server

The first problem ist that in mariadb-server 10.1.37 the innodb_large_prefix is not enabled which caused me a headache with some tables while importing mysqldump. While it is enabled in mysql-server 5.7. So I did the following:

# mysql -u root -p
MariaDB [(none)]> SET GLOBAL innodb_file_format=Barracuda;
MariaDB [(none)]> SET GLOBAL innodb_file_per_table=ON;
MariaDB [(none)]> SET GLOBAL innodb_large_prefix=1;

then log out from mysql. Next I created the nextcloud table and imported the database and upgraded:

mysql -u root -p -e "CREATE DATABASE nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci"
mysql -u root -p nextcloud < /tmp/nextcloud.sql
mysql_upgrade -u root -p --force

then I added the certificate for apache ssl vhost and LDAPS and restarted apache2 and mysql.

The last step was to add the new IP of the nextcloud server to the /etc/exports on the Ganeti master (host) and to auto mount the share in /etc/fstab in the new nextcloud server.

And there you go, everything is there and works perfectly.

NOTE:

if the new nextcloud server has a different host name, you have to do the following:

  • replace the server name in the apache vhost
  • replace the server name in /var/www/nextcloud/config/config.php
  • replace all appearances of the old server name to the new one on nextcloud.sql dump before importing it to the database:

    cp nextcloud.slq nextcloud-org.sql
    sed -i 's/old\.cloud\.server/new\.cloud\.server/g' nextcloud.sql
    

Done

Note:

If you are using mariadb fro debian buster which is mariadb-server 1:10.3.13-1 , the innodb_large_prefixis reenabled again due compatibility. I didn't tested it yet though. https://mariadb.com/kb/en/library/innodb-system-variables/#innodb_large_prefix

Max
  • 143
  • 1
  • 6