Our Owncloud server's disk crashed, beyond repair. All the data is stored on mounted disks (RAID-1), and these seem intact. I have to confess that we don't have a backup of the configuration, as far as I can tell.

Is there a way to safely re-create an Owncloud server using existing data disks on Linux?

Update: screenshot

Screenshot of db files

  • 3
    I would highly recommend backing up the remaining disks before doing anything else. – tonysdg Jan 27 '19 at 3:29

Please note: These steps are only partially tested.

If you had enabled file encryption, I have bad news for you: As the config.php contains a secret key, the files cannot be restored.

If not, I would suggest following steps:

  • Backup what you currently have.

  • Download and extract a fresh copy of OwnCloud

  • Recreate the config as good as you can:

    • Set the database type and path (as you have database file I would guess the database type is sqlite)
    • Set dbtableprefix to your prefix (default is oc_). In doubt, look into your database.
    • Set datadirectory to your data directory
    • Set installed to true.
  • Restore the data directory. It must have the same path as the old one, or OwnCloud won't find the files.

As you have lost the password salt, you have to set new passwords for all users.

Use the occ command to reset the passwords:

$ sudo -u www-data php /var/www/owncloud/occ user:resetpassword admin
Enter a new password:
Confirm the new password:
Successfully reset password for admin

After you login, you should have file access again. If you cannot download the files and get 404 errors, the data directory is probably not at the same location as it was previously.

| improve this answer | |
  • Just checked, files aren't encrypted. Nice! – D.Bugger Jan 27 '19 at 10:32
  • 1
    Reanimated! All that's left is the SSL certificate that has to be reinstalled. Thanks a lot! – D.Bugger Jan 28 '19 at 15:24

This depends what is on that disks that are not dead. If this includes all data directories and, most importantly, the Mysql/Postgresql database, you should have not lost anything except the time to setup a new instance and get stuff working again.

If this doesn't include the database, you are in a bad situation, as you have lost all management information and things like application data (e.g. addressbooks and calender entries). You are still not totally screwed, as at least the actual data files should be present if Owncloud indeed stored that on the still alive disks. There will be directories for every user and group containing the last state of every file, and you can use those to reimport everything into a new instance.

| improve this answer | |
  • Yes, all data directories and the database are there. I updated the question with a screenshot. Is there a description somewhere how to set up the new instance and connect it to the data? – D.Bugger Jan 26 '19 at 22:19

In the future you should regularly create a database dump and copy it to a backup server together with the content of the data directly and the config.php file. And consider moving to Nextcloud because it is more secure, faster, fully open source and has more features. Migration from owncloud to nextcloud is fully supported and easy. Good look with your issue

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.