Reinstall 21 WITHOUT lossing data

Nextcloud version 21
Operating system and version ubuntu 20.04
Apache or nginx version Unknown
PHP version 7.4

The issue you are facing:
so my nextcloud server was runing slow and then I acedently coped config.sample.php to config.php (Long story why).

Considering it was already slow here is what I am trying to do. I am trying to reinstall nextcloud 21 with my data still in place.

Is this the first time you’ve seen this error? Y

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):
I don’t have that anymore

Pealeas help and fast I starting to panic!

Hi Jon,

Your data should still be there even though you messed up something in the config. Perhaps you can tell by looking at the amount of space taken on your drive. Are you using docker?

Hi @jon_will, your data ( only files and folder contain in files app in nextcloud ) is stored by default in /…/nextcloud/data unless you have modified the path in your old config.php.
Do you use encryption module ?
If not, you can move the data folder to other path after that you can reinstall nextcloud.
see this link for make a backup : Backup — Nextcloud latest Administration Manual latest documentation

To restore your data inside the new installation you have to move the data user inside the folder of the user in the new installation and set the right permissions to it. ( www-data for the user and 750 for the permissions).

see this link for more details: Restoring backup — Nextcloud latest Administration Manual latest documentation

1 Like

hi @Mageunic and @Cyrus_Rondolos thank you so much for the response

to answer your questions

  1. I am not using docker. (I used a script for install)
  2. my data is encrypted

I Don’t know if this last one will hart my data so please tell me if it will. I will get right to is when I get answers.

Thank you

@jon_will yes … encrypted files use database and datadirectory but I don’t know if database need specific information of your config.php ( like instanceid or other private information of your server)

You need to make a backup of your database and datadirectory !

thank you but there appears to be nothing in my data directory. Do you have another idea of where to look?

@jon_will this is strange, have you change the path of your data directory? ( by default it is nextcloud/data but nextcloud allow to change this to other folder on other storage )
Normally the path was set in config.php…

I actually have an update. I just so happen to run into a copy of my config.php in /var/NCBACKUP/config/. It’s still really slow but now after an update it’s no longer broken.

If anyone knows how to make it faster pleas tell me because that is the whole resaion we have had this problem in the first place.

But thank you @Mageunic for your help regardless.

1 Like

Have you done anything to try to find out WHY it is slow? Like checking the CPU or memory load? I/O load? Network throughput?

1 Like

@jon_will have you install php-fpm and enable opcache?
see the documentation : Server tuning — Nextcloud latest Administration Manual latest documentation

yes I have

Yes php-FPM and opcache is enabled

Hi @jon_will, have you checked all information requested by @Larry_Boyd?

it can help us to find a solution.

Sorry didn’t see that. But now looking at it about java is taking up over 40% of memory! php-fpm is also taking up so much CPU power(is fluctuates a lot). If you have any ideas of why this is happening let me know the way to fix it. (also to find the the stats I used “top -i”)

Java? What’s that doing? Nextcloud doesn’t use Java. If you have something hitting your memory hard, you could be dealing with swapping. What is the output of free -m?

The server-side work will be mostly between php and database with the greatest portion on php, so you can generally expect the greatest portion of CPU load to be on php. The question, then, is what is a reasonable load? The answer will vary based on a number of factors, including very importantly, your hardware. There are people running nextcloud on high end hardware in datacenters, and there are people running it on toy grade hardware like raspberry pi.

here is the output

          total        used        free      shared  buff/cache   available
          Mem:           3900        3384         137          23         377         117
          Swap:          3899        2146        1753

also I’m ruining it on a high end server and on a VM(4GB ram and 4 CPU cores)

You’re low on memory and swapping like crazy. You need to kill some of your memory users or upgrade.

4 GB and 4 cores VM is definitely NOT what I would consider “high end”.
To put that into context, I’m on bare metal with 64 GB and 8 cores, and mine is somewhat dated and only slightly above entry level for server hardware.

Thank you for the response buttwo things. 1. it is high end. It’s the status of the VM That I gave it in the hypervisor. The server it’s self has over double what you just said. 2. what is a memory user? I never heard o that before. Let me know and that you for the responce.

It doesn’t matter what the server itself has when the VM is neutered like that.

A memory user is exactly what it sounds like – something that uses memory. Processes. Like that java process you were talking about above “taking up over 40% of memory”. If you can kill it, do so.

If that java process is really using 40% of your memory, it would help a lot to get rid of it.
(3384 + 2146) * .6 = 3329 < 3900 — that would bring your total memory utilization to below the total available RAM and reduce/eliminate the swapping.

I killed it and then It poped back up again