Automatic file backup

Does anyone know of a plugin or function that automatically saves selected files as a backup copy, e.g. once a day? We work with Only Office with several users on different files and I would like to have a backup copy in between to go back to this file, if we have a big error.

In general you should always backup your system often enough - so if the outage happens the amount of data you loose is acceptable. the are lot of discussions about right backup strategy and methods - I don’t repeat, google and forum search help you - depending on the data amount, protection requirements and system design different methods could fit better.

The most important point is to spend time to identify possible data loss scenarios and challenge you backup against it - will it help? just to give you few ideas:

  • user deletes files
  • server crashes
  • malware attack (deletion/encryption - is my backup affected as well?)

I am more afraid of incorrect entries in the common file or incorrect sorting in tables, which then have to be painstakingly corrected individually, as far as this can still be traced at all. That’s why I want a daily backup so that I only have to reconstruct for a maximum of 24 hours. At the moment, one of my employees always creates a so-called “daily backup file” in the evening.

You also must backup the database.
You can test this app: Nextbackup

For normal backup (database, cofig, sytstem, data, …) use operation system features.

Please do not make a backup
Also test the backup on a test server look restore

If you can not make or like backups use a “Managed Nextcloud” from a hoster for money or change to Microsoft, …

Actually, I would also like the file to simply be saved as a copy and this automatically always at a certain time.

As I am running my Nextcloud system in a Linux Container I am using Snapshots for day-to-day rollback functionality and just before applying updates from apps and NC versions, and OS apps apps and patches. It works so brilliantly that this feature alone, should be the recommended installation method.

However for complete backups, I actually have a script which runs once a week, that exports the data folder and everything underneath it, to a 7z encrypted folder, which I uploads to google drive.

As I use LDAP server for user authentication and groups also running in a seperate LXC container, the routine of snapshotting is the same for this. Backup of the LDAP, is regular LDIF exports to an encrypted 7z folder I also uploads to google drive.

I also backup the database by a complete SQL dump to a 7z enctrypted folder I also uploads to google drive.

The methods used for this is straightforward and only the complete dump of the data folder is a pain. I do this because even though I use ZFS filesystem to enable snapshotting, I can still get a corrupt disk. Until now I have never had the need for using the backups placed in Google Drive, but I have had to rollback to an earlier snapshot many times.

And to use the above in context of the thread: You can automate snapshotting of linux containers natively with LXC.

1 Like

Hi @AlexKa

Per default Nextcloud does versioning of your files. This is of course not a replacement for proper backups but should cover most situations where someone messed things up in a file, and you have to be able to go back to a previous state.


Good answer. But as you say: Should not be a replacement for proper backups.
The thing in regards to versioning of files is that is enables good chance of recovering files from a ransomware or corruption of files points of view. But unless a hardcore NC admin, database errors and/or Redis corruption can equally mess up your system and render the versioning useless (for regular and not that exsperienced NC admins).

The versioning feature is exactley designed for the usecase @AlexKa described in the OP. If he means by “having a big error” that the Nextcloud is going down, of course this won’t help.

Otherwise, I think you are pretty well set up with your backup concept. If the data folder is on a ZFS filesystem, you can theoretically take hourly or even quarter-hourly snapshots. If you then need to restore a single file, you can clone a specific snapshot, mount it and manually extract individual files so that not all data is restored to a previous state.

1 Like

that’s the way. Thanks for the link. Can you sent me a screenshot, where i find the “old” versionierung? Where have i to click for it?

Excactly. Thats what I do aswell. I forgot to add that I actually do the hourly snapshotting. My NC installation privately used. No corporate or big user base, so the eventual one or two file I might miss by “only” doing thos hourly, is fully acceptable. But you are correct. I use the LXC config for automatic snapshot schedule. It works very, very well. :slight_smile:

1 Like

I beleives bb77s answer should be marked as the Solution as it points to the feature meant for excactly this.

version control as mentioned by @bb77 and flow could help you to keep history of the file so you can identify and revert errors within documents content.

both solutions don’t protect you against system failure (hardware problem, malware attack) as mentioned by @Kerasit and @devnull - the system admin should setup right backup procedure to address such issues.

is not a solution! they don’t offer user accessible backups. most likely they perform actions to restore data in case of desaster but this is completely in the background - user facing part of MS services has recycle bin and/or file version functionality - that’s all. for majority of use cases it’s enough but as of now you have no chance to recover documents you deleted before recycle bin threshold or recover the whole system state at specific date… depending on you backup strategy, tools and space you available for backups your own backup solution may miss this requirements as well - but here you have full control - for common cloud solutions you have to accept what is offered by the provider.


@wwe @AlexKa
Yes Microsoft is not the solution.
But if backup fails and data loss in nextcloud it is your fault but all users think nextcloud is the fault.

Personally I have found Backuppc really good for setup and forget daily backups on my Nextcloud box and various other servers and PCs. You don’t say what OS your Nextcloud instance uses but if Linux then it is straightforward (once you have set up Backuppc).

sorry wrong post

I use rdiff-backup to back up my nextcloud instance data nightly. It does incremental backups, so just stores the changes made to files, not the whole file. You can easily browse the backup and restore files. You can also do things like automatically delete increments older than, say, six months to save space.