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.
- Go to Settings > System.
- Under Application Paths heading scroll down to Backup Directory Path.
- Set directory to store your backups.
- Go to Settings > Tasks.
- Under Backup heading you will find 2 tasks.
- 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:
- Go to Settings > System, scroll down to Database heading and check your Database Path location.
- Create a backup of the current database. (optional)
- Stop Stash.
- In your file browser, go to the location of your database path.
- Move or delete the
stash-go.sqlite
database file (along with the-shm
-wal
.journal
files if present). - Copy the backup file that you want to restore to
stash-go.sqlite
. - Make sure that you now have a
stash-go.sqlite
file and that no-shm
-wal
.journal
files are present. - 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.