Backup owncloud server with s3 as primary storage

Hi all

I’ve set up a owncloud 10.5 server with a single S3 bucket as primary storage. Is there a recommended way to backup the files? They are stored as binary objects which are related to the owncloud database. Therefore I assume that a replicated bucket will not work.

Thanks
Quirin

What is the scenario you want to cover? Do you just want to do single file restores or do you want to restore the whole bucket in case it accidentally gets deleted?

So if you restore an S3 objects they will be different in some kind of way? That a database dump with the original file won’t be able to access the restored file?

If you want to backup an ownCloud you’re always supposed to take a backup of the database as well. As sharing information is only saved in there:
https://doc.owncloud.org/server/admin_manual/maintenance/backup.html

I’m not aware of a specific ownCloud recommendation for S3 storage backups. So unfortunately you are kind of on your own to figure out a working process, unless somebody else in the community has some pointers.

1 Like

Hi Erik

Thank you for your answer. I want to restore single file objects and recover a disaster like a deleted bucket.

If owncloud uses a filesystem as primary storage or S3 as external storage the files are stored “as they are” and can be copied, restored and so on. Also the database can be updated via a occ files:scan command.

If owncloud uses S3 as primary storage the objects in the S3 bucket are binary files organized by the “S3 Object Storage” plugin. Also the occ scan command is not working in this case (at least in my test setup).

So my question is how can I get a consistent file/database backup if the “S3 Object Storage” plugin is used.

Link to Plugin:
https://marketplace.owncloud.com/apps/files_primary_s3

Take a backup of your database (mysqldump/…). Take a backup of the files in a way you can recreate them exactly the same as before (not sure how that works). Make sure that it isn’t possible to add/delete/modify files in between taking a db-backup and the backup of the files.

Now in the case you restore the whole bucket, all file objects are available again under the same URLs as before. Then you can restore the database which links to the file objects you just restored.

This is at least my theoretical first idea for a test. I would recommend you try it out and then see if there are potential problems and then figure out how you could mitigate them.

For single file restores, I would recommend to restore the file somewhere locally and then use the webinterface or ownCloud client to reupload it into ownCloud.

1 Like

I found no good way to handle backups and restores with the s3 object storage.

  1. You can backup bucket and database near at the same time. If you are lucky no changes where made in between this two backups. If yes this data is not available anymore.

  2. Restoring a single file is very complex. You have to run a second restore ownlcoud instance to activate the bucket backup and copy a file.

I think in my case the better approach is to setup a local storage on EBS and backup the data to S3 using restic.

2 Likes

Hi,
I am also having the same question as you in mind, Is there any way to backup and restore without using EBS because for s3 storage I am not using AWS but I am using Minio.