How do you backup your NextCloud?

A Nextcloud backup is the config folder, the data folder and the database, copied together with the server in maintenance mode. Nextcloud's Backup app cannot be installed on the current release, so on Nextcloud 34 the backup is yours to run — unless you installed All-in-One, which ships its own.

Watch on YouTube · published Sep 27, 2026 · 2:54

A Nextcloud backup is three things you cannot skip — the config folder, the data folder and the database — copied together while the server is in maintenance mode. No app does this for you on the current release: the app called Backup in Nextcloud's own store cannot be installed on Nextcloud 34.

Everything below was checked in September 2026 against a fresh Nextcloud 34.0.3 — the official Docker image, on a Linux server — and the version 34 administration manual. The manual's commands assume Nextcloud installed directly on Linux; if yours runs in Docker, the Docker versions are further down.

Is there a Nextcloud backup app?

There is one called Backup, and on the version you would install today it is not an option. Search the app store on Nextcloud 34 for "backup" and three apps come up — Backup, NextBackup and OwnBackup — with no install button on any of them. Backup's details read: "This app cannot be installed because the following dependencies are not fulfilled: Server version 28 or lower is required." It was last updated in January 2024. NextBackup requires version 20 or lower, OwnBackup 17 or lower.

That does not mean Backup was abandoned. It means there is no release of it for anything newer than Nextcloud 28.

An earlier version of this page described "External Storage Support" as a built-in backup app. It is not one. It mounts other storage inside Nextcloud; it does not copy your server anywhere.

What does a Nextcloud backup need?

The administration manual lists five things to retain:

  1. The config folder
  2. The custom apps folder (only if you have custom apps installed)
  3. The data folder
  4. The theme folder
  5. The database

Three of them you cannot restore without. The data folder is your files. The config folder is how the server is set up. The database is what makes those files Nextcloud: accounts, shares, and the record of every file and where it lives. The restore page says it flatly: "You must have the database, data directory, and configuration files. You cannot complete restoration without all three."

Why turn on maintenance mode first?

In the manual's words, maintenance mode "locks the sessions of logged-in users and prevents new logins in order to prevent inconsistencies of your data."

If someone uploads while you are copying, the files and the database can end up from different moments. The backup looks complete and is not. The restore page describes what that looks like afterwards: when the database is newer than the data directory, "the files would be visible but not accessible."

How do you back up Nextcloud, step by step?

  1. Turn on maintenance mode: sudo -E -u www-data php occ maintenance:mode --on
  2. Copy the config, data and theme folders somewhere outside your Nextcloud server — or the whole installation directory, which the manual also allows: rsync -Aavx nextcloud/ nextcloud-dirbkp_`date +"%Y%m%d"`/
  3. Dump the database. For MariaDB: mariadb-dump --single-transaction -h [server] -u [username] -p[password] [db_name] > nextcloud-sqlbkp_`date +"%Y%m%d"`.bak. For PostgreSQL: PGPASSWORD="password" pg_dump [db_name] -h [server] -U [username] -f nextcloud-sqlbkp_`date +"%Y%m%d"`.bak
  4. Turn maintenance mode off again: sudo -E -u www-data php occ maintenance:mode --off
  5. Restore it once, onto a test server, from the backup alone. A backup you have never restored is a guess.

Once that works by hand, put the same steps in a script and schedule it with cron. Keep at least one copy somewhere other than the server it came from.

How do you back up Nextcloud in Docker?

The same three things matter; they just live somewhere else. In the official Docker image, the config and data folders are inside the Nextcloud volume (/var/www/html), and the database runs in its own container with its own volume. Nextcloud's Docker documentation says a backup needs "one volume for your database container and one for Nextcloud". Replace the container and volume names with yours (docker ps and docker volume ls list them):

  1. Maintenance mode on — occ runs inside the Nextcloud container: docker exec --user www-data nextcloud php occ maintenance:mode --on
  2. Copy config, data, themes and custom apps out of the Nextcloud volume: docker run --rm -v nextcloud:/src:ro -v "$PWD":/backup alpine tar czf /backup/nextcloud-vol.tar.gz -C /src config data themes custom_apps
  3. Dump the database from its container. PostgreSQL: docker exec nextcloud-db pg_dump -U nextcloud nextcloud > nextcloud-sqlbkp.bak. MariaDB: docker exec nextcloud-db mariadb-dump --single-transaction -u nextcloud -p[password] nextcloud > nextcloud-sqlbkp.bak
  4. Maintenance mode off: docker exec --user www-data nextcloud php occ maintenance:mode --off

If you mounted host folders instead of named volumes, copy those folders directly, exactly as in the manual's steps above.

Can you run a Nextcloud server on Windows?

Not directly. The operating systems listed in Nextcloud's system requirements for the server are all Linux: Ubuntu, Red Hat Enterprise Linux, Debian and SUSE. Windows appears there only for the desktop sync app. Guides that "install Nextcloud on Windows" run it inside Docker Desktop, WSL or a virtual machine — which is Linux underneath — so the Docker steps above are the ones that apply.

What if you installed Nextcloud All-in-One?

Then you have a backup built in. The All-in-One project's own documentation: "Nextcloud AIO provides a backup solution based on BorgBackup." It is run from the AIO interface, including restore. Everyone else follows the manual above.

Full video transcript

1
00:00:00,000 --> 00:00:04,777
Nextcloud has an app called Backup. On
the current version, it won't install.

2
00:00:04,817 --> 00:00:07,842
So here's what a Nextcloud
backup actually needs,

3
00:00:07,882 --> 00:00:10,156
straight from Nextcloud's own manual.

4
00:00:10,196 --> 00:00:14,387
Three things you can't skip, and
one rule about when you copy them.

5
00:00:15,896 --> 00:00:19,409
This is Nextcloud thirty
four, the current release.

6
00:00:19,449 --> 00:00:24,535
It runs in Docker, on a Linux server
I run myself. This is its app store.

7
00:00:24,855 --> 00:00:29,767
Search for backup. Three apps come up,
and none of them has an install button.

8
00:00:30,074 --> 00:00:34,219
Open the one called Backup.
This app cannot be installed.

9
00:00:34,259 --> 00:00:37,816
Server version twenty
eight or lower is required.

10
00:00:37,856 --> 00:00:40,499
It was last updated in January 2024.

11
00:00:40,841 --> 00:00:43,494
To be fair, that doesn't
mean it was abandoned.

12
00:00:43,534 --> 00:00:47,218
It means there's no release for
anything newer than twenty eight.

13
00:00:47,258 --> 00:00:50,410
On the version you'd install
today, it isn't an option.

14
00:00:50,765 --> 00:00:55,451
The others are older still. NextBackup
needs version twenty or lower.

15
00:00:55,765 --> 00:01:01,571
So what does a backup actually need?
Nextcloud's own admin manual answers it.

16
00:01:01,875 --> 00:01:05,107
Five main things you need to
retain. The config folder.

17
00:01:05,147 --> 00:01:09,806
The custom apps folder, if you've added
any. The data folder. The theme folder.

18
00:01:09,846 --> 00:01:10,857
And the database.

19
00:01:11,194 --> 00:01:14,828
Three of those you can't skip.
The data folder is your files.

20
00:01:14,868 --> 00:01:17,599
The config folder is how
the server is set up.

21
00:01:17,639 --> 00:01:20,791
And the database is what
makes those files Nextcloud.

22
00:01:20,831 --> 00:01:24,807
Accounts, shares, and the record
of every file and where it lives.

23
00:01:25,174 --> 00:01:29,197
Before you copy anything, the
manual turns on maintenance mode.

24
00:01:29,237 --> 00:01:33,389
It locks the sessions of logged
in users and prevents new logins,

25
00:01:33,429 --> 00:01:36,009
to prevent inconsistencies of your data.

26
00:01:36,372 --> 00:01:37,659
Here's why that matters.

27
00:01:37,699 --> 00:01:39,871
If someone uploads while you're copying,

28
00:01:39,911 --> 00:01:43,355
your files and your database can
end up from different moments.

29
00:01:43,395 --> 00:01:45,608
The backup looks complete, and it isn't.

30
00:01:45,959 --> 00:01:48,528
The restore page shows what's at stake.

31
00:01:48,938 --> 00:01:53,525
You must have the database, data
directory, and configuration files.

32
00:01:53,565 --> 00:01:56,967
You cannot complete
restoration without all three.

33
00:01:57,305 --> 00:02:00,706
And when the database is
newer than the data directory,

34
00:02:00,746 --> 00:02:03,584
the files would be visible
but not accessible.

35
00:02:03,624 --> 00:02:06,314
That's what a mismatched
backup looks like.

36
00:02:06,657 --> 00:02:11,195
One note if yours runs in Docker, like
this one. The same three things matter.

37
00:02:11,235 --> 00:02:16,125
Your files and config sit in a Docker volume,
and the database in its own container,

38
00:02:16,165 --> 00:02:18,766
so the manual's commands
need a small change.

39
00:02:18,806 --> 00:02:20,626
The page linked below has them.

40
00:02:21,595 --> 00:02:26,857
So a Nextcloud backup is the config
folder, the data folder, and the database,

41
00:02:26,897 --> 00:02:30,391
copied together with the
server in maintenance mode.

42
00:02:30,431 --> 00:02:33,450
On today's version, no
app does that for you.

43
00:02:33,490 --> 00:02:38,684
The one exception is Nextcloud All-in-One,
which has its own backup built in.

44
00:02:38,724 --> 00:02:42,218
Whichever you use, restore
it once on a test server,

45
00:02:42,258 --> 00:02:45,616
because a backup you've
never restored is a guess.

46
00:02:45,656 --> 00:02:49,422
The checklist, with the Docker
version of every command,

47
00:02:49,462 --> 00:02:51,365
is on the page linked below.


Related reading