Backup Grafana, what files are needed?

Hello
Is it correct that i only need to save the lib/grafana/ directory to restore grafana on a new system? i search for the correct way to safe all, if the system crash down and i need to reinstalll ubuntu

Thank you

2 Likes

It’s a bit more invovled than just that one directory, and it depends on what you’ve got installed and set up, but here’s a set of instructions, hopefully this helps.

Backup:

  1. Backup the Grafana configuration file (grafana.ini).
  2. Backup the Grafana database (grafana.db): The db stores all the dashboards, users, and other metadata. You can find the location of the database in the grafana.ini file under the [database] section. Make sure to have a copy
  3. Backup the Grafana provisioning directory (if applicable): If you have any custom provisioning files or plugins, make sure to back up the entire provisioning directory. The location of the provisioning directory can be found in the grafana.ini file under the [provisioning] section.
  4. Backup any additional data sources and dashboards: If you have configured external data sources or have created custom dashboards, make sure to back up the necessary files or configurations associated with them.

Restore

  1. Install as usual
  2. Stop the Grafana service
  3. Restore the configuration file (grafana.ini)
  4. Restore the Grafana database (grafana.db). Make sure file has the correct permissions (chown grafana:grafana grafana.db).
  5. Restore the Grafana provisioning directory (if you had one)
  6. Restart the Grafana service

This should do the trick.

2 Likes

thank you a lot!
best regards

1 Like

I don’t have any grafana.db file on my system.

I’ve managed to backup and restore my data with this convenient tool:

Hello David:
My Grafana installation runs on top of docker-compose.

And I am as interested as jumbo125 in backing it up; I have invested a lot of time in the folders, dashboards and panels.

Regarding your answer to jumbo125, I have been able to find the files/folders referenced in points 1, 2 and 3 of your answer.

¿ Would you please tell me how to address point #4 ?: “… Backup any additional data sources and dashboards…”

  • Âż which ones should be considered "custom dashboards? Âżand where would I find them?
  • Âż in which cases are datasources considered “external”?

Your kind hints will be greatly appreciated
Best regards

Rogelio