Blog · Part 1, Foundations
Storage and folder layout
One media folder, one user, the right permissions. Get this right now and every app in the stack sees the same files the same way.
Most problems people hit with Jellyfin, Sonarr and Radarr aren’t about the apps. They’re about folders: one app can’t see a file another app wrote, or sees it at a different path, or isn’t allowed to rename it. Ten minutes of planning today saves hours later.
The layout
Use one top-level folder for all media, and a subfolder per kind:
/data
└── media
├── movies
├── tv
└── music (optional)
And one folder for the apps themselves, their settings and the file that describes how they run:
/opt/media-server
├── compose.yaml
└── config
├── jellyfin
├── sonarr
├── radarr
├── bazarr
└── seerr
Why these two, kept apart:
/datais big and slow. It lives on your hard drives. It’s the thing you protect with redundancy./opt/media-serveris small and precious. It lives on the SSD. It’s the thing you back up every night (Day 24), because it holds every setting, every user, and every bit of “who watched what”.
Use these exact paths throughout the series and every example will work as written. If your disk is mounted somewhere else (say /mnt/storage), you can either point /data at it with a symbolic link, or replace /data with your path everywhere you see it.
The one-path rule
Every app should see the media at the same path inside its container: /data. That means Sonarr, Radarr, Bazarr and Jellyfin all agree that a film is at /data/media/movies/Some Film (1954)/Some Film (1954).mkv.
This sounds pedantic. It matters because these apps tell each other about files by path. When Radarr tells Jellyfin “I just added /data/media/movies/...”, Jellyfin needs to find it at exactly that path. Many guides mount /movies in one container and /media/films in another, and then spend a weekend wondering why nothing lines up.
One user owns everything
Create a single Linux user that owns the media and runs the apps. On a fresh Debian or Ubuntu install, the first user you created already has the ID 1000, and that’s what this series uses.
Check your IDs:
id
You’ll see something like uid=1000(alex) gid=1000(alex) groups=.... Note the uid and gid. If yours aren’t 1000, replace 1000 with your numbers wherever the series uses them.
Now create the folders and give them to that user:
sudo mkdir -p /data/media/{movies,tv,music}
sudo mkdir -p /opt/media-server/config/{jellyfin,sonarr,radarr,bazarr,seerr}
sudo chown -R 1000:1000 /data /opt/media-server
sudo chmod -R u=rwX,g=rwX,o=rX /data
The last line lets the owner and group read and write, and everyone else only read. It’s a sensible default for a home server.
How apps run as that user
Every app in this stack runs in a container (tomorrow’s topic). Each container image has its own way of being told which user to run as:
- Jellyfin’s official image takes a
user: 1000:1000line. - The LinuxServer.io images for Sonarr, Radarr and Bazarr take
PUID=1000andPGID=1000settings. - Seerr’s image always runs as user
1000, which is why we chose that number.
When they all run as 1000, they can all read and write the same files without any permission juggling.
Hard drives, mounted
If your media disk is a separate drive, it needs to be mounted at boot. Find its ID:
lsblk -f
Then add a line to /etc/fstab (replace the UUID and filesystem with yours):
UUID=your-disk-uuid /data ext4 defaults,nofail 0 2
The nofail option lets the server still start if the disk is unplugged, instead of hanging at boot. Run sudo mount -a to mount it now, then df -h /data to check it’s the size you expect.
If the drive was formatted for Windows or macOS (NTFS, exFAT, APFS), reformat it as ext4 before putting a library on it. Linux permissions don’t work properly on those formats, and that’s the root of many “permission denied” errors. Reformatting erases the disk, so copy anything on it somewhere else first.
Network shares
If your media lives on a separate NAS and the server reads it over the network, mount the share at /data with the same user ID:
//nas.local/media /data/media cifs credentials=/root/.smbcreds,uid=1000,gid=1000,nofail 0 0
It works, but it’s the slowest and most fragile option. If you have the choice, run the apps on the machine that has the disks.
What about music, photos, books?
Jellyfin handles music and photos too, and other “-arr” apps exist for music and books. This series sticks to films and series. The music folder is there so you can add it to Jellyfin when you want, using the same rules.
Check it worked
ls -ln /data/media /opt/media-server/config
Every folder should show 1000 1000 as owner and group. If any says 0 0 (root), run the chown command again.
Tomorrow: Docker and Compose, the way every app in the stack will be installed.
Use these tools with media you own or are authorized to use, and with public-domain works. Medusa does not host, provide, or stream any media of its own.