Back up these three things:
Also save any other files you have customized. Keep backups outside the Traccar installation directory, preferably with a copy on another computer.
Use the instructions for your database. Run the commands from the folder where you want to save the backup. Replace USER with your database username and traccar with your database name if different.
Stop Traccar, copy the data folder, then start it again. On a default Linux installation:
sudo systemctl stop traccar
sudo cp -a /opt/traccar/data ./data
sudo systemctl start traccar
On Windows, stop Traccar in the Services console, copy the data folder from the installation directory, then start the service again.
mysqldump -u USER -p --single-transaction traccar > traccar.sql
Enter your database password when prompted. For MariaDB, use mariadb-dump instead of mysqldump.
pg_dump -h localhost -U USER -Fc traccar > traccar.dump
Use Tasks > Back Up on the Traccar database in SQL Server Management Studio and choose a full backup.
Stop Traccar before restoring. Restoring a backup replaces your data with the saved version, so keep a copy of anything you might still need.
For H2, replace the data folder with your backup.
For MySQL or MariaDB, restore into an empty database named traccar:
mysql -u USER -p traccar < traccar.sql
Use mariadb instead of mysql for MariaDB. Create the empty database first if it does not exist.
For PostgreSQL, restore into an empty database:
createdb -h localhost -U USER traccar
pg_restore -h localhost -U USER -d traccar traccar.dump
Skip createdb if the empty database already exists. For TimescaleDB, follow its restore instructions, which require additional extension setup steps.
For Microsoft SQL Server, use Restore Database in SQL Server Management Studio.
Restore traccar.xml and the media folder, then start Traccar and check that your devices and history are available. When recovering from a failed upgrade, use the Traccar version that matches the backup. See Upgrading Traccar.
Use the same database backup commands with your database container. Save the backup files on the host, along with your configuration and media. For H2, stop the Traccar container before copying its data folder. A container image alone is not a backup of your data.