You are reading an outdated version of this documentation. Please check out the latest version of the server administration manual.


To backup an Nextcloud installation there are four main things you need to retain:

  1. The config folder
  2. The data folder
  3. The database
  4. The theme folder

Backup Folders

Simply copy your config, data and theme folders (or even your whole Nextcloud install and data folder) to a place outside of your Nextcloud environment. You could use this command:

rsync -Aax nextcloud/ nextcloud-dirbkp_`date +"%Y%m%d"`/

Backup Database


Before restoring a backup see Restoring Backup


MySQL or MariaDB, which is a drop-in MySQL replacement, is the recommended database engine. To backup MySQL/MariaDB:

mysqldump --single-transaction -h [server] -u [username] -p[password] [db_name] > nextcloud-sqlbkp_`date +"%Y%m%d"`.bak


sqlite3 data/owncloud.db .dump > nextcloud-sqlbkp_`date +"%Y%m%d"`.bak


PGPASSWORD="password" pg_dump [db_name] -h [server] -U [username] -f nextcloud-sqlbkp_`date +"%Y%m%d"`.bak