Cannot find a precise guide to move JUST THE METADATA to external SSD MacOS

Server Version#: 1.41.6.9685
Player Version#: 4.145.1
<If providing server logs please do NOT turn on verbose logging, only debug logging should be enabled>

Hi all, I am running Plex Media Server on an M1 Mac mini with only the small 256GB standard SSD internally. My Plex library is held on an external Thunderbolt drive, all works fine. The problem is my plex metadata is very big and I’ve run out of room. What is the simplest and easiest way to take all plex data off the internal drive and move it to an external SSD (2TB)? I have looked around and while I see several guides, including those on the Plex forum, Reddit and YouTube, nothing I can find specifically shows how to do this (that I can find). Can someone either point me in the right direction or give me a quick tutorial? Many thanks..

I would look at minimising your Plex Photo Transcoding cache Folder, which can grow to ridiculous sizes. I have seen it over 100GB

This can be easily done.

Just shut down Plex and Delete the Cache Folder contents mentioned, found in the Home Directory ~` Go Menu. Then Empty Trash. It will re populate as you use your Collection but will take awhile.

I also Highly recommend using the following utility created by a Plex Member, which will maintain a health size of this Cache Folder for you by using it on a regular basis. It will also help with possible Database corruption and speed of your PMS.

I copied 2 directories to my external drive and created symlinks to them inside the plex directory structure. You want to copy and then link these 2. I’m running on linux, so your paths may be different.
cd “/var/lib/plexmediaserver/Library/Application Support/Plex Media Server”
Media and Metadata are the huge directories.
cp -a them to your external drive.
There are lots of files in these. It will take a long time to copy.
stop plexmediaserver
mv Media Media.old
mv Metadata Metadata.old
ln -s /path-to-ext-drive/Media Media
ln -s /path-to-ext-drive/Metadata Metadata
start plexmediaserver
confirm it works and rm the .old directories when you’re comfortable.

BTW, I use a regular HDD for these (not SSD) and it works great.

My cache dir is relatively small.

/var/lib/plexmediaserver/Library/Application Support/Plex Media Server# du -sch Cache/PhotoTranscoder/
236M Cache/PhotoTranscoder/

The other 2 dirs I mentioned are what eat up the space:
/var/lib/plexmediaserver/Library/Application Support/Plex Media Server$ du -sch Media/* Metadata/*
259G Media/localhost
1.3G Metadata/Albums
1.5G Metadata/Artists
5.3G Metadata/Movies
9.6G Metadata/TV Shows
276G total

I see, you must have Video Previews enabled for all your Libraries. That would explain such a huge Application support folder.

Thanks @SE56
I disabled and deleted the video preview for my movies only and it reduces the Media folder size by 44GB. I see that’s what allows you to see a little screen when fast-forwarding/rewinding and I like that feature, so I’m good with my solution to symlink the Media folder to an external drive.

BTW, I tried the PlexDBRepair utility. It didn’t find any errors. I went ahead and did a purge of the Photo Transcoding cache Folder and it actually grew by 8MB! Strange, but not an issue for me.

@Steve_W Maybe what you really want to move is your Media folder…

Okay,
considering your feature preference of Video previews I can see a symlink option a fruitful process.

It is interesting that the Photo Transcoding Cache increased and will ask @ChuckPa his thoughts on the matter.

This has been a thoughtful discussion for the OP and anyone reading.

Cheers

Folks,

I see references here about creating symlinks.

My advice - DON’T DO IT!

There are parts of PMS which will NOT follow the symlinks.
PMS is NOT designed to be chopped up

If /var/lib/plexmediaserver gets too big for the root partition
(EXTREMELY COMMON)

Then please consider doing it the right way – Move PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR in its entirety.

Even I needed to do it.

  1. I set PMS to run as my username
  2. I moved PMS from the SSD to the RAID volume
[chuck@lizum ~.1999]$ cat /etc/systemd/system/plexmediaserver.service.d/override.conf 
[Service]
Environment="PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR=/vol/plexmediaserver"
User=chuck
Group=chuck
[chuck@lizum ~.2000]

Doing it was VERY simple:

sudo bash
mkdir /vol/plexmediaserver
cd "/var/lib/plexmediaserver/Library/Application Support"
systemctl stop plexmediaserver
tar cf - . | ( cd /vol/plexmediaserver ; tar xf -)
chown -R chuck:chuck /vol/plexmediaservr

Now create the override file above.

systemctl daemon-reload
systemctl start plexmediaserver

if you’ve done it correctly,

  1. PMS is running as the username you assigned
  2. You’ll see the logfile activity in the new APP_SUPPORT_DIR path (drill in)

No need to carve up the subdirectories anymore
No more complicated backups

1 Like

Supplemental to this.

DBRepair will go look for the override.conf and use it to get to where you moved PMS

DBRepair will not know what to do with symlinks when determining how much to clean out (prune/purge) because a symlink to a directory is 4K bytes. It doesn’t matter that there might be 20GB behind that link.

1 Like

Hum,
Thanks for the through explanation @ChuckPa. What’s your opinion for how I should structure my files in my case? Sorry this is so long, but I do have questions at the end:

I have a linux system with 1TB SSD /raid and it hosts several virtual linux boxes and a few docker containers. All disk images live in /raid/vboxfiles/…
One virtualbox is for media. It runs plex, samba, etc and has 32GB / and /var .vdi files. All tv/movie/pictures are on a 14TB usb3 drive that is only mounted within the media virtualbox. The 14T drive currently also contains Media and Metadata PMS directories because they previously blewup the media virtual drive root file which filled my SSD making it impossible to clone/shrink .vdi files.
Then I split /var off and moved all PMS files to usb drive. I thought it wasn’t smart to put all of PMS on an external drive. I still wanted the database and cache parts of PMS on the virtual /var drive so it lived on the SSD /raid.

Question is:
Do I put all PMS on usb drive?
or Expand media /var to 500GB let PMS live in default location and keep periodically (painfully) trimming /var virtual disk if it’s even possible at that size?
or Use shared folder feature of virtualbox so PMS lives on /raid on the host computer and is available to media as /raid-PMS?
or Do I scrap the idea of media being a virtualbox and run plex, samba, jellyfin via docker on the hardware host directly on /raid?
or Have I got too convoluted of a setup and I shouldn’t be allowed to play?

My theory behind my setup is that the hardware host system only needs ssh and virtualbox installed. Everything else is configured/restored via virtual hosts. I’ve gone through several host systems changes and rebuilds without the headache of configuring or messing with individual apps. I just started learning about docker and while it’s cool, it’s still hard to get some things to work properly.
BTW, my 14T usb drive gets rsync’d daily to another usb drive and individual files within each virtualbox system also get rsync’d via ssh to usb drives that rotate over 4 separate drives.

Thanks for your assistance.

I understand your questions.

I have a good idea why you’re asking ( you’re jogging my memory of years ago lol)

Before getting started, I have a few questions of my own and a few comments

  1. What’s the OS which VirtualBox is running on? If Linux, which Distro/version ?

  2. If you needed more physical storage, would that be an option?

  3. If you were to move things around, how many VMs / apps would need to be handled ? (count of)

  4. How savvy / comfortable are you with doing things at the command line ?
    ( you mentioned SSH access )

I’m asking because, if I’m understanding your implications here,
I might have a solution for you which will make life easier

  1. Don’t use docker unless you have to ( I don’t use docker at all )
  2. Don’t use VMs unless you really have no choice ( I don’t use any )
  3. Implement differently
  • I use Linux Containers instead of VMs - Faster than any VM but has a full OS
  • Linux Containers allow you to put multiple programs (e.g. docker apps) in one container. ( All my OTA media is processed in a LXC )

This might address your various apps / needs. We’ll explore that.

My workstation is Ubuntu 22,04
My Linux Containers (LXC) are for everything work (with one personal container)
I create containers as I need them for testing PMS releases. I have a script which automates the setup.

+-------------+---------+----------------------+----------------------------------------------+-----------+-----------+
|    NAME     |  STATE  |         IPV4         |                     IPV6                     |   TYPE    | SNAPSHOTS |
+-------------+---------+----------------------+----------------------------------------------+-----------+-----------+
| almalinux   | RUNNING | 192.168.0.241 (eth0) |                                       (eth0) | CONTAINER | 0         |
+-------------+---------+----------------------+----------------------------------------------+-----------+-----------+
| lxconsole   | RUNNING | 192.168.0.226 (eth0) |                                       (eth0) | CONTAINER | 0         |
+-------------+---------+----------------------+----------------------------------------------+-----------+-----------+
| plex        | RUNNING | 192.168.0.248 (eth0) |                                       (eth0) | CONTAINER | 0         |
+-------------+---------+----------------------+----------------------------------------------+-----------+-----------+
| plexdev     | RUNNING | 192.168.0.246 (eth0) |                                      (eth0)  | CONTAINER | 0         |
+-------------+---------+----------------------+----------------------------------------------+-----------+-----------+
| rocky9      | RUNNING | 192.168.0.238 (eth0) |                                      (eth0)  | CONTAINER | 0         |
+-------------+---------+----------------------+----------------------------------------------+-----------+-----------+
| snap-script | RUNNING | 192.168.0.230 (eth0) |                                      (eth0)  | CONTAINER | 0         |
+-------------+---------+----------------------+----------------------------------------------+-----------+-----------+
| wirepod     | RUNNING | 192.168.0.100 (eth0) |                                      (eth0)  | CONTAINER | 0         |
+-------------+---------+----------------------+----------------------------------------------+-----------+-----------+
[chuck@lizum ~.2002]$ 

I’m sure I’ve confused you. I apologize.

Let’s go over the questions I’ve asked and see what can be (reasonably) down and how to grow forward

My topology is:

  1. All media stored on external RAID 6 volume (on DIY NAS)
    Backups are to another NAS (image backup of the whole NAS - rsync)
  2. PMS is installed as a native app on the NAS
  3. PMS is relocated to a directory on the main RAID volume (144 TB)
  4. Other tools/services are in LXC.

I just finished changing my setup actually. I didn’t see your response until now (thanks btw for taking the time).

I was running Ubuntu 24.04.2 LTS Desktop as media virtualbox on top of a Ubuntu 24.04.2 LTS Desktop host.

Now I’ve eliminated the media virtutualbox and am running plex, jellyfin, and samba out of docker-compose containers with the usb drives “directly” used by the host system. Plex was the easiest of them to get working under docker. Docker-compose allows bundling of several systems together and coordinating their running and communications. Interesting stuff.

I just had to buy a replacement drive for one doing the ‘click of death’ so more storage isn’t in the budget right now.

I’m very command line savvy.

I still have other virtualboxes going (separate mail, file, and vpn client boxes). I’m not familiar with Linux containers, but I guess I should learn now. I do like the idea of having all of my media stuff bundled in one container.

I am learning about “mount --bind” and that may be an alternative to symlinks, but I haven’t had good experience with it so far (timing between drives being available and when the system tries to mount the additional bind points).

I will say that having the Metadata and Media folders on the tv/movie drive has made swapping PMS installs around easy and fast. I’ll try setting up PMS in a linux container and let you know how it goes.

For the curious my current setup is:
Ubuntu 24.04.2 LTS Desktop with 240GB root, 1TB /raid for virtualbox disks and docker, 14TB /media for tv/movies/etc, 22TB rsync of everything.

Plex uses image: lscr.io/linuxserver/plex:latest
Jellyfin uses image: jellyfin/jellyfin
Samba uses image: andrespp/samba-ldap that includes openldap and phpldapadmin servers in docker-compose.

VIrtualboxes:
mail - postfix and dovecot
file - samba, personal docs, vnc-server at times.
vpn - vpn client, vnc-server, browser, etc

bind mounts are powerful. That’s how docker works :wink:

You really need consider the Metadata & Media --AND-- Databases as a trio for without the Databases directory, Metadata and Media are useless.

All linkage between physical media and files stored in Metadata and Media is stored in the Databases.

Now to the crux of my original point. – After you move Databases, Media, and Metadata somewhere, there’s very little left behind

This is why I assert the “Keep It Simple” and move the whole thing.
It’s also why everything is under /config

— Unless I’m really missing something important here for which I apologize.

I have to ask @Steve_W why not have the whole Plex install on your external SSD or Thunderbolt drive? You can set a specific temp dir for the Transcoder in the Settings. You did say you are running on a Mac mini and not Linux as @ChuckPa tips documents so I’m not sure of the exact steps you need to set the PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR on your system.

I wonder why Plex developers chose to have such huge directory trees for Media and Metadata instead of having all of it in databases. Just doing a du on the trees takes a long time.

It would also be nice if the Library setup was in a file like Preferences. Easy to copy/restore.

I always assumed that Plex would rebuild the Media and Metadata dirs from the Library collection and download from the Internet if it still had it’s database but not the other dirs. I also assumed the database needed a fast disk, but maybe my collection is too small for it to matter.

For me, I think I’ll stick with docker-compose and add a volume in docker-compose.yaml for the PMS dir to be on my external usb drive, getting rid of the symlinks and avoiding the hassle of setting PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR.

Thanks for the good discussion. I did look into LXC and it’s not for me. :wink:

I almost asked that same question but then realized. – If you put it in a database then ALL the metadata could be lost by a single corruption of the DB.

Plus, as a monolithic item, it’s even harder to deal with

— IF —

  • You do not modify default metadata downloaded for your media
  • Add metadata or other uploads to your metadata
  • You have a backup copy of the Databases directory (PMS shutdown)
  • After a failure, all the preexisting media is in the same location

– THEN –

  • You can completely recover what you previously had from only the Databases
  • The only thing you will lose is time as mediainfo is regenerated and metadata is downloaded.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.