The directory structure on my media server is largely a holdover from when I was using a pathetically slow Buffalo Linkstation Quad NAS box as my media server years ago. It was a long way from the recommendations made here. I decided to try doing something about that. This is a quick write-up of what I did.
My current server is a homebuilt machine, put together around an Asrock Rack X470D4U2-2T with a Ryzen 5 2600, 32 GB of RAM, and four 8-TB 7200rpm NAS hard drives in software RAID-5. It runs Arch Linux on the metal, with Docker running on top of that to support all of the services that run on it. It’s been a pretty solid little box that sits next to the living-room TV, on the floor.
The RAID array is at /mnt/storage
. It has two subdirectories, movies
and tv-shows
, with the obvious contents. I use the lscr.io/linuxserver/sonarr
and lscr.io/linuxserver/radarr
Docker images. /mnt/storage/tv-shows
was originally mounted in the Sonarr container to /tv
and /mnt/storage/movies
was originally mounted in the Radarr container to /movies
. These were both in accordance with the documentation provided for the images.
Now, /mnt/storage
is mounted in both containers to /data
. /data/tv-shows
is added as a root folder in Sonarr and /data/movies
is added as a root folder in Radarr. If you look under “Library Import” in the *arr interface, the original root folder will show few (if any) unmapped folders while the new root folder will show a whole bunch of unmapped folders.
At first, I was going to hit each show or movie individually and edit the root folder setting manually. This was going to be inordinately tedious. Fortunately, there is a better way. It involves changing root folder paths in the SQLite databases.
First, we’ll do Sonarr. Bring up the Sonarr database in the SQLite command-line client:
docker exec sonarr apk add --no-cache sqlite; docker exec -it sonarr sqlite3 /config/sonarr.db
Run this query to update the paths. These are what I used, as described above; you’ll want to adjust for your setup.
update Series set Path=concat('/data/tv-shows/', substr(Path, 5)) where Path not like '/data/%';
Exit out of the client with .quit
, then restart Sonarr with docker compose restart sonarr
. If you go back to “Library Import” in Sonarr, you should now see that your shows have moved from the old root to the new root.
Radarr is similar, but with an extra SQL query to update the auto-managed collections. First, bring up the SQLite client:
docker exec radarr apk add --no-cache sqlite; docker exec -it radarr sqlite3 /config/radarr.db
These are the queries I used; again, adjust yours for your setup.
update Movies set Path=concat('/data/movies/', substr(Path, 9)) where Path like '/movies/%';
update Collections set RootFolderPath='/data/movies' where RootFolderPath='/movies';
Exit out of the client with .quit
, then restart Radarr with docker compose restart radarr
. If you go back to “Library Import” in Radarr, you should now see that your movies have moved from the old root to the new root.
At this point, you can remove the old root folders within the *arrs and update your Docker Compose files accordingly.