IT in Education

Creating a backup of Nextcloud

nextcloudThis article describes the process that needs to be followed in order to have a working backup.


Maintenance mode

Before taking a backup of Nextcloud, you must first put it in maintenance mode. This is very important! I've tried restoring from backups of instances that weren't first put in maintenance mode, and they almost never work.

Database

Assuming that you use MySQL, you will need to get a dump of the database.

  1. Access your database using phpMyAdmin.
  2. Browse to the database in the left pane.
  3. Select the Export tab.
  4. Click Go to download an SQL file of your database.

I also typically compress this export using gzip.

Config, themes and data directories

There are three important directories, that you need to backup as a minimum. You could of course copy all Nextcloud directories.

  1. Access the root directory of your Nextcloud instance.
  2. Take a copy of the following directories.
    1. /config
    2. /data
    3. /themes

For simplicity, I usually take a copy of all files in the root directory.

Maintenance mode

Now that you have a complete backup, you can come out of maintenance mode.


Thanks for visiting,
Steven