# Backing up a FiveM server properly

> Back up a FiveM server properly: what to include, mariadb-dump with --single-transaction, automated daily backups, retention and test restores.

Source: https://fam-tools.com/guides/fivem-server-backups · FAM Tools · published 2026-09-11 · updated 2026-09-11 · about 10 min

**Short answer.** Back up three things: the database (the most valuable), the server-data folder (resources and configs) and txData (admins, bans, player history). Dump the database daily with `mariadb-dump --single-transaction`, compress it, keep 7–30 days, and copy it off the machine (for example with rclone to object storage). Test a restore on a separate database at least once.

## Key points

- Database first — it holds characters, money, items and vehicles.
- `--single-transaction` gives a consistent dump without locking InnoDB tables.
- Automate it: cron on Linux, Task Scheduler on Windows.
- A backup on the same disk is not a backup — copy it off-site.
- An untested backup is a hope, not a plan.

Every long-running server eventually has its bad day: a script wipes inventories, a disk dies, a staff account is compromised or a host disappears. The servers that survive are the ones with yesterday’s database somewhere else. Backups are boring to set up once and priceless the first time you need them.

## What to back up

| What | Why | How often |
| --- | --- | --- |
| Database | Characters, money, inventories, vehicles, houses | Daily (or more) |
| server-data | Resources, server.cfg, custom edits | After changes; weekly |
| txData | txAdmin admins, bans, warnings, player history | Daily |
| Secrets (licence key, tokens) | Needed to rebuild | Stored safely once |

## Dumping the database

*Linux*

```bash
mariadb-dump -u backup -p"$DB_PASS" --single-transaction --routines --triggers fivem | gzip > /backups/fivem-$(date +%F).sql.gz
```

*Windows (adjust the MariaDB version in the path)*

```bat
"C:\Program Files\MariaDB 11.4\bin\mariadb-dump.exe" -u backup -p%DB_PASS% --single-transaction --routines --triggers fivem > C:\Backups\fivem.sql
```

Create a dedicated backup user with only the rights it needs (`SELECT`, `SHOW VIEW`, `TRIGGER`, `LOCK TABLES`, `EVENT`). On MySQL the tool is called `mysqldump`; MariaDB ships both names.

## Automating and rotating

*/etc/cron.d/fivem-backup*

```bash
# every day at 05:30, keep 14 days
30 5 * * * root /usr/local/bin/fivem-backup.sh && find /backups -name "fivem-*.sql.gz" -mtime +14 -delete
```

Run the dump at a quiet time, ideally a few minutes after a scheduled restart. On Windows, a Task Scheduler task running a `.bat` file does the same job.

## Off-site copies

Copy backups away from the server — object storage, another VPS or a home NAS. `rclone copy /backups remote:fivem-backups` works with most storage providers. Follow the 3-2-1 idea: three copies, two kinds of storage, one off-site.

> **Backups contain personal data** — Dumps include player identifiers and sometimes IPs. Store them encrypted or with restricted access, and delete old ones.

## Practising a restore

*Restore into a test database*

```bash
mariadb -u root -p -e "CREATE DATABASE fivem_restore CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci"
gunzip < /backups/fivem-2026-09-10.sql.gz | mariadb -u root -p fivem_restore
```

Point a test server at `fivem_restore` and log in. If your character, money and vehicles are there, your backups work. Database setup basics: [MariaDB setup](https://fam-tools.com/guides/fivem-mariadb-database-setup).

## Questions

### How do I back up my FiveM database?

Run `mariadb-dump --single-transaction` (or `mysqldump`) on your database daily and keep compressed copies off the server.

### Does txAdmin back up my database?

No. txAdmin keeps its own data in txData; back up the database yourself.

### How long should I keep backups?

7–30 daily backups plus a few weekly or monthly ones cover most situations.

### Can I back up while the server is running?

Yes. `--single-transaction` makes a consistent dump of InnoDB tables without stopping the server.

## Related

- https://fam-tools.com/guides/fivem-mariadb-database-setup
- https://fam-tools.com/guides/fivem-scheduled-restarts
- https://fam-tools.com/guides/txadmin-setup-guide
- https://fam-tools.com/guides/fivem-linux-server-setup
