docs-site/content/guide/backups.md
When you send documents to Typesense, it stores your data in the directory indicated by the data-dir <RouterLink :to="`/${$site.themeConfig.typesenseLatestVersion}/api/server-configuration`">server configuration parameter</RouterLink> and then builds the in-memory data structures that power search.
When a Typesense process is restarted, the data is read from the data directory and the in-memory indices are rebuilt.
:::tip This article only applies when you self-host Typesense. :::
It is unsafe to directly archive/backup Typesense's data directory, since Typesense might have open files that it's writing to, as the backup is being taken. Instead, you want to do the following:
tar -czvf backup.tar.gz -C /tmp/typesense-data-snapshot .rm -rf /var/lib/typesense/*cd /var/lib/typesense ; tar -xf backup.tar.gz .Typesense will then read the snapshot from the data dir and build the in-memory index.