Documentation

Backup, restore and moving

Everything Home Stream knows about your library lives in one folder. Keep a copy of it and you can put the server back, or move it to another machine, without scanning or matching anything again.

What lives where

There are two kinds of thing here, and they are looked after differently.

The data folder

This is the folder you named as DATA_DIR in your .env file. It holds:

Your library

This means your films, television, music and home videos, in the folders listed under Settings → Library Folders. The server doesn't keep a copy of them and has no way to back them up for you. Back them up the way you would any other files you care about.

When you delete something in Home Stream, it goes into a hidden .homestream-trash folder inside that library folder. It stays there until you empty the trash, and a backup of the library folder includes it.

Backing up the database

There are two safe ways. Choose whichever suits you.

While the server is running

SQLite, the database Home Stream uses, can make a consistent copy of itself while it is in use. The sqlite3 tool isn't inside the Home Stream image, so run it on the machine itself. If the machine doesn't have it, install it from your system's package manager.

Run it as the user that owns your media, the one whose numbers are HOST_UID and HOST_GID in .env. The database is readable only by that user.

cd /path/to/your/data-folder
sqlite3 openhomestream.db ".backup '/path/to/backups/homestream.db'"
chmod 600 /path/to/backups/homestream.db

Don't copy openhomestream.db with an ordinary file copy while the server is running. A plain copy is only safe once the server has stopped.

With the server stopped

From the folder that holds compose.yaml and .env (~/homestream if you used the installer):

docker compose stop
cp -a /path/to/your/data-folder /path/to/backups/homestream-data
docker compose start

This copies the whole data folder, artwork included. Anything playing will stop while the server is down, so pick a quiet moment.

The database is the part that matters most. If you can, copy the rest of the data folder as well, because account pictures and home-video collection pictures exist nowhere else.

What a backup holds, and why to keep it private

A backup is safer than you might expect, but it is still private.

Keep backups where only you can read them. If you keep a copy away from the machine, encrypt it first.

Restoring

  1. Stop the server

    From the folder that holds compose.yaml and .env (~/homestream if you used the installer), run docker compose stop.

  2. Put the file back

    Copy your backup into the data folder as openhomestream.db, replacing the one there. Make sure it belongs to the same user as before. The server tightens its permissions when it starts. If you are restoring the whole data folder, put the whole folder back in place.

  3. Start it again

    Run docker compose start. Then open Settings → Server → Software Update and check that the database schema is shown with no warning beneath it.

Anything that happened after the backup was taken is gone. That includes watch progress, new accounts and settings you changed. Devices that signed in after that point will need to sign in again. Files you added to the library since then are picked up by the next scan.

An older or newer database

The database has a version of its own, called the schema. It is shown beside the server's version in Settings → Server → Software Update.

Moving to a new machine

  1. Stop the old server

    Run docker compose stop, so nothing changes while you copy.

  2. Copy the data folder across

    Copy the whole folder and keep its ownership, for example with rsync -a. On the new machine it should belong to the user that owns your media there.

  3. Bring the two set-up files

    Copy compose.yaml and .env (from ~/homestream if you used the installer). Then edit DATA_DIR, MEDIA_ROOT, HOST_UID and HOST_GID to suit the new machine.

  4. Start it

    Run docker compose up -d. Artwork follows the data folder wherever it goes, so pictures appear without any extra step.

  5. Check your library folders

    Open Settings → Library Folders. If your library is mounted at the same path as before, everything is already there. If the path has changed, the folder shows Not connected. Choose Re-point… and pick where it is now. The server tells you how many items it found there.

The server finds your media through the folders you registered. It doesn't use a full path for every file, so re-pointing a folder is all a move needs. Watch history and favourites stay attached.

Automatic updates are set up on the machine itself, not inside Home Stream, and so is the one-time step that lets the apps find the server on their own. Running the installer on the new machine sets both up.

Moving the data folder to a bigger drive

Stop the server and copy the folder to the new drive, keeping ownership. Change DATA_DIR in .env, then run docker compose up -d.

Moving your library to a new drive

Settings → Library Folders has two different buttons for this. They are easy to mix up, so here is what each one does.

Move files…

The server copies everything under that folder to the new place and checks the copy. Only then does it remove the originals. Everything stays playable throughout. Library Folders shows how far it has got, and the move carries on if you close the page.

Re-point…

Nothing is copied. This tells the server that the same files now live somewhere else. Use it after you have copied the files yourself, or when a drive comes back at a different path. It reports what it found, either that everything came back or how many items it couldn't find.

Either way, the container can only see folders it has been given. Before you start, add the new drive under volumes in compose.yaml, then run docker compose up -d:

    volumes:
      - /path/to/new-drive:/path/to/new-drive

Only the administrator can change library folders.

Updating safely

All documentation · Next: Troubleshooting