# \[Help\] Backing up mariadb with "mariadb-backup"

**URL:** <https://help.nextcloud.com/t/help-backing-up-mariadb-with-mariadb-backup/238807>\
**Category:** ℹ️ Support\
**Tags:** nc32, caddy, docker, backup, mariadb, php84, truenas\
**Created:** [January 16, 2026, 10:39pm UTC](https://help.nextcloud.com/t/help-backing-up-mariadb-with-mariadb-backup/238807 "2026-01-16T22:39:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![janusng](https://help.nextcloud.com/user_avatar/help.nextcloud.com/janusng/32/5579_2.png) [@janusng](https://help.nextcloud.com/u/janusng)\
**Post date:** [January 16, 2026, 10:39pm UTC](https://help.nextcloud.com/t/help-backing-up-mariadb-with-mariadb-backup/238807/1 "2026-01-16T22:39:01Z")

</div>

> **Support intro**
>
> ## Sorry to hear you’re facing problems. 🙁
> 
> _The community help forum ([help.nextcloud.com](http://help.nextcloud.com)) is for home and non-enterprise users. Support is provided by other community members on a best effort / “as available” basis. All of those responding are **volunteering their time to help you.** _
> 
> **If you’re using Nextcloud in a business/critical setting, paid and SLA-based support services can be accessed via [portal.nextcloud.com](http://portal.nextcloud.com) where Nextcloud engineers can help ensure your business keeps running smoothly.**
> 
> ## Getting help
> 
> In order to help you as efficiently (and quickly!) as possible, please fill in as much of the below requested information as you can.
> 
> **Before clicking submit** : Please check if your query is already addressed via the following resources:
> 
> - [Official documentation](https://docs.nextcloud.com) (searchable and regularly updated)
> - [How to topics and FAQs](https://help.nextcloud.com/c/how-to-faqs/9)
> - [Forum search](https://help.nextcloud.com/search)
> 
> (Utilizing these existing resources is typically faster. It also helps reduce the load on our generous volunteers while elevating the signal to noise ratio of the forums otherwise arising from the same queries being posted repeatedly).

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can. ❤

## The Basics

- Nextcloud Server version _(e.g., 29.x.x)_:
  - `Nextcloud Hub 25 Autumn (32.0.4)`

- Operating system and version _(e.g., Ubuntu 24.04)_:
  - `TrueNAS SCALE Community Edition 25.10.1 - Goldeye`

- Web server and version _(e.g, Apache 2.4.25)_:
  - `nginx/1.28.0`

- Reverse proxy and version \_(e.g. nginx 1.27.2)
  - `caddy v2.10.2`

- PHP version _(e.g, 8.3)_:
  - `PHP 8.4.16`

- Is this the first time you’ve seen this error? (Yes / No):
  - `Not applied`

- When did this problem seem to first start?
  - `Not applied`

- Installation method _(e.g. AlO, NCP, Bare Metal/Archive, etc.)_
  - `docker image linuxserver/nextcloud`

- Are you using CloudfIare, mod\_security, or similar? _(Yes / No)_
  - `No`

### Summary of the issue you are facing:

I would to do a periodical backup. As the instance is running on ZFS, I take periodical snaphots of all the files and settings and back them up. The issue is the database. The instance is running on MariaDB. I know the official recommendation is `mysqldump/mariadb-dump`. However, it takes hours to do a full backup.

I am thinking about an alternative that utilizes `mariadb-backup` to do an incremental backup and running the following script periodically after a full backup:

```auto
#!/bin/bash

export BACKUP_DIR_IN_CONTAINER='/config/backup/2026-01-16'

ts=$(date +'%Y-%m-%d_%H-%M-%S%z')
docker exec nextcloud occ maintenance:mode --on
docker exec nextcloud-mariadb mariadb-backup --backup \
	--databases="nextcloud" \
	--target-dir="${BACKUP_DIR_IN_CONTAINER}/incremental-${ts}/" \
	--incremental-basedir="${BACKUP_DIR_IN_CONTAINER}/base/" \
	--user=ncuser \
	--password="mypassword"
docker exec nextcloud occ maintenance:mode --off

```

Is it a viable solution? Any other thing I have missed?

Many thanks.

---

<div class="post-metadata">

**Author:** ![janusng](https://help.nextcloud.com/user_avatar/help.nextcloud.com/janusng/32/5579_2.png) [@janusng](https://help.nextcloud.com/u/janusng)\
**Post date:** [January 17, 2026, 9:55pm UTC](https://help.nextcloud.com/t/help-backing-up-mariadb-with-mariadb-backup/238807/2 "2026-01-17T21:55:12Z")

</div>

After running it a couple days, I realized that incremental backups are not any quicker than backing up with `mysqldump`/`mariadb-dump` but it is significant susceptible to corruptions.

I understand the reasons behind the official approach now.

Due to the extended down time with `mysqldump`/`mariadb-dump` , is a master-slave cluster the best compromise in term of redundancy?

---

<div class="post-metadata">

**Author:** ![janusng](https://help.nextcloud.com/user_avatar/help.nextcloud.com/janusng/32/5579_2.png) [@janusng](https://help.nextcloud.com/u/janusng)\
**Post date:** [January 22, 2026, 6:48pm UTC](https://help.nextcloud.com/t/help-backing-up-mariadb-with-mariadb-backup/238807/3 "2026-01-22T18:48:48Z")

</div>

For people in the future who may run into this situation:

I discovered there are commands for taking snapshots of the database with external tools. They are called `BACKUP STAGE`. It is a much quicker solution I have been waiting for.

---

<div class="post-metadata">

**Author:** ![system](https://help.nextcloud.com/user_avatar/help.nextcloud.com/system/32/29333_2.png) [@system](https://help.nextcloud.com/u/system)\
**Post date:** [April 22, 2026, 6:48pm UTC](https://help.nextcloud.com/t/help-backing-up-mariadb-with-mariadb-backup/238807/4 "2026-04-22T18:48:55Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
