Linux

Where Does a Lemmy Server Store Data?

Lemmy reads lemmy.hjson for config, with images in pict-rs storage and posts in PostgreSQL.

Last updated

Lemmy splits into three containers with three volumes. The backend reads lemmy.hjson (database URL, hostname, pictrs address). Pict-rs serves images from its /mnt mount, mapped to ./volumes/pictrs on the host. PostgreSQL holds posts under ./volumes/postgres.

From scratch installs use /opt/lemmy with LEMMY_CONFIG_LOCATION pointing at the hjson. Docker installs mount the same file to /config/config.hjson. Either way the trio of config, image store, and database defines the instance.

Where Lemmy stores this, by platform

Linux
./volumes/pictrs

Image store mount for pict-rs (UID 991). Postgres data sits in the sibling ./volumes/postgres folder. Config file mounts to /config/config.hjson.

Linux
/opt/lemmy/lemmy-server/lemmy.hjson

Bare install layout. Binary plus lemmy.hjson here, pict-rs dirs beside it. Point the systemd unit at this config with LEMMY_CONFIG_LOCATION.

Frequently asked questions

How do I back up a Lemmy instance?

Back up the postgres volume, the pictrs volume, and lemmy.hjson together. The database references image files by hash, so one without the other breaks media.

Image uploads fail with permission errors. What fixes it?

Fix ownership to UID 991 on the host pictrs folder. The container runs as 991:991 and fails to write uploads when the mount belongs to root.

How do I use a config file in a custom path?

Set LEMMY_CONFIG_LOCATION in the environment or systemd unit. Docker mounts the file to /config/config.hjson instead.

Notice an outdated path? Let us know.