Data loss nextcloud

I am running Zima 1.5 with a configured RAID5 array composed of 4 disks, each 16TB in size.
I installed Nextcloud with the data directory set to /media/NAS, which contained all my files. Unfortunately, Nextcloud has deleted all the files in that directory, and now I am unable to recover them.
I have tried using Disk Drill for recovery, but it doesn’t recognize or mount the RAID location, so it can’t scan or recover the missing files. I am unsure how to proceed and desperately need help with any methods or tools that could help me retrieve the lost data from my RAID5 NAS running ZimaOS.
If anyone has experience recovering data from ZimaOS RAID5 arrays or using recovery tools compatible with this setup, your advice would be greatly appreciated

It looks like the issue wasn’t with your RAID but with how Nextcloud was set up. When the data directory is pointed to an existing folder like /media/NAS, Nextcloud assumes control of it and can overwrite or delete any existing files during initialization. Your RAID5 array should still be healthy, the problem is that the folder itself was restructured by Nextcloud, not a hardware failure.

Thank you for your response! You’re absolutely right, the raid5 is healthy and functioning normally. The problem occurred because I pointed Nextcloud’s data directory to /media/NAS, which already contained all my files. I didn’t realize that Nextcloud would take control of that folder and delete all the existing content (19TB) during initialization
Now I’m trying to recover the deleted files. I have SSH access to the NAS and can see the mounted raid5 volume, but I’m struggling to find effective recovery tools that work in this situation. I tried DiskDrill via SSH, but the connection keeps dropping. I’m now looking into PhotoRec or other recovery software that can handle this kind of scenario
Do you have any recommendations for recovery tools or methods that might work well for my case? Any advice would be greatly appreciated!

I’ve seen a few cases like this before, and it’s unfortunately not a RAID failure but how Nextcloud handles its data directory during setup. When you point Nextcloud to an existing folder (like /media/NAS), it assumes full ownership of that location and restructures it completely for its own use. That means anything already inside can get deleted or overwritten during initialization.
The good news is that your RAID5 array itself is probably still intact, it’s just the directory contents that were altered. The reason Disk Drill can’t see anything is because ZimaOS uses Linux mdadm (software RAID) or sometimes Btrfs, which Windows and macOS tools don’t recognize.
If you want to try recovering data, your best chance is from within Linux:
Assemble the RAID in read-only mode using mdadm --assemble --readonly.
Mount it carefully to avoid further writes.

Scan it using UFS Explorer RAID Recovery or R-Studio for Linux (both work well with mdadm arrays). Free options like PhotoRec or TestDisk can also help, though they’re less targeted.

If Nextcloud overwrote the data blocks, recovery success might be limited, but if it mainly changed the structure, you could still get some files back.

For future setups, it’s safest to give Nextcloud its own folder (e.g. /DATA/AppData/nextcloud-data) and never point it to an existing share. That way, it builds its structure without touching your stored files.

Really hope this helps you get some of that data back, and don’t worry, your RAID should still be fine underneath.

2 Likes

Just to add some context, the reason he (and many others) used the Nextcloud Server version on ZimaOS is that it lets your NAS act like your own private cloud service. Once it’s running, other devices (phones, laptops, etc.) can connect to it using the Nextcloud Client, just like they would to Google Drive or Dropbox.

The confusion usually happens because both versions, the client and the server, look like they’re doing the same thing, but they actually work very differently. The Nextcloud Server is meant to host and manage the data, users, and sharing, while the Nextcloud Client is just there to sync or mirror files from another server.

So, when someone sets up the server and points its “data directory” to an existing folder (like /media/NAS), the server assumes it’s a brand-new, empty directory it can control. It then restructures or overwrites anything already in it. On the other hand, the Nextcloud Client simply syncs files without touching the folder structure, that’s why it works safely on Windows when you mirror your C:/ drive.

Therefore:

Nextcloud Server > Hosts the cloud. Needs its own empty data folder.

Nextcloud Client > Connects to a server. Safely syncs existing files.

It’s an easy mix-up to make, especially when you just want “Nextcloud on your NAS”, but understanding that difference saves a lot of headaches later.

2 Likes

That is a very good explanation on how that works. I think NextCloud needs a writeup on how to implement it safely on Zima docs / exploring. Your way of describing it made me think about when I add my raid, it will be a blank slate with nothing on it, maybe I should do my whole raid that way. I’m going to look a little closer, but so long as what goes in it isn’t automatically saved to anyone that has access and downloaded, it would probably be Ok. On the other hand if I create 2 folders 1 ‘Cloud’ and 1 ‘Archive’ I can have a place to save things.
Also question, if I were to do the whole volume, it could still be used for data like Paperless-ngx, immich, so forth ?

Use Nextcloud to make your NAS your private cloud