Skip to content

Backup and restore database

Backup

Always use the UI to create a backup of the database. As with all live databases DO NOT copy manually the database file as a means of backup.

Stash uses an sqlite database with WAL mode enabled. This practically means that along with the main db file stash.go-sqlite there can be a -shm and a -wal file present (more info). Even stopping Stash might leave some of these index files present so again DO NOT manually copy the database file.

The Backup or Download Backup tasks are the proper way to create a backup file.

  1. Go to Settings > System.
  2. Under Application Paths heading scroll down to Backup Directory Path.
  3. Set directory to store your backups.
  4. Go to Settings > Tasks.
  5. Under Backup heading you will find 2 tasks.
  6. Select either Backup or Download Backup task.

Restore

Assuming you have properly created a backup file you can use it to restore your database if needed.

Info

The restore procedure uses the default stash-go.sqlite filename, if you changed that when configuring Stash adjust accordingly.

The following steps are recommended when restoring a database file:

  1. Go to Settings > System, scroll down to Database heading and check your Database Path location.
  2. Create a backup of the current database. (optional)
  3. Stop Stash.
  4. In your file browser, go to the location of your database path.
  5. Move or delete the stash-go.sqlite database file (along with the -shm -wal .journal files if present).
  6. Copy the backup file that you want to restore to stash-go.sqlite.
  7. Make sure that you now have a stash-go.sqlite file and that no -shm -wal .journal files are present.
  8. Start Stash.

You should now have Stash running with a working and restored database.

Advanced troubleshooting

If you get a database malformed message during upgrade or backup that probably means that the database is already corrupt. One way to get past that is to do a full export and check the error log. If there are not a lot of errors you can then try to do a full import and get a working db with minimal losses. As the full import is destructive proceed with caution. For cases like this it is better to ask for support.