New install of Nextcloud

Hi all. Sorry if this was asked before, I could not find what I need.
.
I have Nextcloud server v11 up and running which is an upgrade from v9, which is upgrade of ownCloud, all on Debian Jessie. Most of the users are connecting via LDAP.
Now I’d like to wipe the server (except the user data partition), do a fresh install of Debian and Nextcloud. Is there a way to keep/import/link/map the user data and all settings (shares, etc.) in this fresh install? Not wiping the server is not an option :slight_smile:

Thank you

If you want only import data and not contact, shares … you can install a fresh Nextcloud 20 and import only the data. But you will lost all data like shares in MariaDB.

I think the only way to keep all data and structure is to upgrade over all versions from v11 to v20. I think i would copy and dump all data to a test-server and upgrade there from v11 to v20. While upgrading you must also change sometimes operation system version and with it the php version. For better upgrade perhaps accept losing some data or apps you can reinstall in final version again. If all works copy nextcloud back to your production server. Make backups.

How do I import only the data? If I understand how users in LDAP work, they do not exist until hr/she loggs in for the first time. Than the user is created in DB. And user direcotory is created for his/her data.

Will the old user data/directory be associated with the new “user” if he/she has the same username?

I tested it. If data exists i can not create a new user. But you can after creating the user with default data copy the data from another directory back in the user directory and the use “occ files:scan …”

No. But normally you use different paths.

old:
/var/www/html/nextcloud-old-not-used-anymore/data/username/files
new:
/var/www/html/nextcloud/data/username/files
(exists after first usage from the user)

Than you can copy or move data from one directory to the other and use “occ files:scan”.

Perhaps better:
If you use both nextcloud (old and new, different names) perhaps the user can copy the data with federation on self service. Then you do not need a rescan.

I tested it. If data exists i can not create a new user. But you can after creating the user with default data copy the data from another directory back in the user directory and the use “occ files:scan …”

I’m sorry, I did not understand this. I cannot create user if his data exist?

Yes. On my nextcloud i created a folder data/username/files and inserted a few files. I hoped with creating the user “username” nextcloud use this folder with the data. But i only got an error and it does not work for me (Nextcloud 20.0.1).

Perhaps a better solution is to implement a new nextcoud instance (new name), create all users with default or no data (skel data) and then use fedaration to the old nextcloud. But hen you lost all shares.

Ok, I understand I will lose all shares with new installation, the DB is empty. Copying/moving user files is not a bad idea, it is doable :slight_smile: Thank you

Perhaps it is possible to use database operations on the old nextcloud database like export shares and modify the shares in the new nextcloud database. I think export and import of contacts or calendar is possible for each user. Also look at all other apps.