Guide

Make and restore a backup

Make a verified copy of the database from Settings, check that it would restore, and put one back on the host when you need it.

Admins only Checked against v3.1.0 Updated Edit this page Report a problem

Liner notes

At a glance

Who
Admins only
Where
Settings › Backups
You need
  • Shell access to the host, for a restore
  • The host folders the container mounts at /app/config and /app/cache
Backups kept
The newest 5

A backup is a copy of the database, which holds your settings, accounts, playlists, requests and history, plus the undo copies Library Management keeps so its changes can be put back. There is no backup schedule. DroppedNeedle makes one by itself only when a new version is about to change the database (a pre-upgrade backup). Make one by hand whenever you want a fresh copy.

What a backup holds#

DataIn a backup?
Settings, accounts, playlists, requests, historyYes: they are all in the database
Undo copies for Library ManagementYes, in the shared backups/undo folder
The key file config/data_enc.keyNo. Keep it with your backups: without it, the passwords and API keys stored in a backup can’t be read
metadata-cache.db (provider answers)No. It is fetched again when needed
Your music, the plugins folder, and other files in the cache folder (such as profile pictures and held downloads)No. A backup copies only the database and the undo copies

Make a backup#

  1. Open the Backups settings#

    Go to Settings › Backups. The pane reads “Copies of the database, settings included.” and “The newest 5 are kept.”

  2. Press Back up now#

    Result: a toast reads Backed up: with the file name and size, and the backup tops the list. Each row shows its name, such as library-1732400000000-0.db, then its date, size and Schema number.

  3. Check the backup#

    Press Check on its row.

    Result: the Check backup dialog reads This backup can be restored. and lists each check with a tick or a cross. Checking reads the backup and changes nothing.

  4. Keep a copy of the backups folder and the key file#

    Backups are written to the backups folder beside the database: /app/cache/backups in the container, so backups inside the host folder you mount at /app/cache. Copy the whole backups folder, not only the .db files, since the undo copies are in backups/undo. Keep config/data_enc.key with it.

Restore a backup#

Restoring is done on the host with the server stopped, never from the web UI. These commands are from Backups and restore, which also has the form for Unraid, Portainer and Synology, where you use docker run instead of Compose.

  1. Stop the server#

    bash
    docker compose stop droppedneedle

    droppedneedle is the service name in the compose file. Use yours if it differs.

  2. Restore the backup into an empty folder#

    Put the backup’s file name in place of BACKUP.db:

    bash
    docker compose run --rm droppedneedle droppedneedle-tool restore --backup /app/cache/backups/BACKUP.db --target-dir /app/cache/restored

    droppedneedle-tool checks the backup first and never replaces a file. It writes library.db and the undo copies the backup names into the target folder.

  3. Move the restored database into place#

    On the host, in the folder the server mounts at /app/cache:

    bash
    cd /path/to/cache
    rm -f library.db-wal library.db-shm
    mv restored/library.db library.db
    cp -an restored/undo/. undo/

    The -wal and -shm files belong to the old database, so they go first. The restored file replaces the current library.db. Instead of moving it, you can point LIBRARY_DB_PATH at /app/cache/restored/library.db.

  4. Check the key file#

    config/data_enc.key must be the key saved with this backup. A key from another server or another backup is refused.

  5. Start the server#

    bash
    docker compose up -d droppedneedle

    Result: DroppedNeedle starts on the restored database, with the settings, accounts and history it held.

Go back to the version you ran before an update

A database a newer version has migrated can’t be opened by the older image. Restore the backup taken before the update, then change the image tag back and start the container. Going back after a failed update has the steps.

Check it worked#

  • After Back up now, the new file is at the top of Settings › Backups, and Check reports This backup can be restored.
  • After a restore, the server starts and your settings, users and playlists are as they were when the backup was made.

If something went wrong#

Each heading below is the message DroppedNeedle shows.

Backup failed

The toast shows the server’s reason when it has one. A backup that fails its own checks is never put in place, and the backups you already had stay as they were. Check health and read the logs shows where to look.

Database in memory

The alert on Settings › Backups reads “It and its backups are lost on restart. Map /app/cache to a disk or pool path.” The cache folder is on tmpfs or ramfs. Copy the backups folder out while the container runs, then move /app/cache to a disk: Storage and permissions has the commands.

This backup cannot be restored.

The list under it names the check that failed, such as integrity-check or schema-version. Pick another backup from the list and press Check on it.

refusing restore into non-empty target

The target folder already holds files. Remove the old restored folder, or give --target-dir a new folder name.

the key file … is missing, but the database … already holds this server's data

The server refuses to start and changes nothing. Put back the data_enc.key saved with this database, in config. The same goes for “the key file … does not belong to the database …“. Only if that key is lost for good, see The key file for droppedneedle-tool reset-key --yes, which clears every stored password and API key.

Docs