Move cache folder or simply library

Server Version#: Version 4.22.3
Player Version#: N/A

hi and sorry for my bad english, i’m french ^^

I’ve got a problem, my primary partition “/” is full and my biggest folder is the plex cache folder.

df -h return this :

df -h
Filesystem      Size  Used Avail Use% Mounted on
udev             16G     0   16G   0% /dev
tmpfs           3.2G   58M  3.1G   2% /run
/dev/md1         20G   19G     0 100% /
tmpfs            16G   20K   16G   1% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs            16G     0   16G   0% /sys/fs/cgroup
/dev/md0        283M   64M  200M  25% /boot
/dev/md2        7.2T  6.5T  420G  94% /data
tmpfs           3.2G  4.0K  3.2G   1% /run/user/1000
tmpfs           3.2G     0  3.2G   0% /run/user/108

my goal would be to move cache (or all library folder) on /data/

i saw this post but i’m afraid to broke plex : Moving PMS 'Library'

if i copy “/var/lib/plexmediaserver/Library/Application Support/” in “/data/Library/Application Support/” chown it to plex:plex

i rename /var/lib/plexmediaserver/Library/Application Support by Application Support.bak

sudo service stop plexmediaserver

nano /lib/systemd/system/plexmediaserver.service

and point
Environment="PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR=/var/lib/plexmediaserver/Library/Application Support" to the newly created folder
Environment="PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR=/data/Library/Application Support"

start the service

Do you know if this action will work ?

ps : i thought too symlink but i don’t know how this work

Thanks for your help and sorry again for my english ^^

Here is how to move it.

No risk to lose the “watching statuts” for all users ?

if you

  1. Stop PMS
  2. make the tar image and move it, in its entirety, to the new location, there will be no loss.
  3. Don’t forget to create the override.conf file to tell PMS where to look for the new metadata Application Support directory.

The procedure actually makes a mirror clone/copy of the data.
That’s why it works.

If PMS was running when you shut it down,
moving it
making the override file
starting it will bring it right back to where it was.

ok, so i’ll try this method.

Question.
PMS service is stopped
when i want to

systemctl edit plexmediaserver

i’m copying this :

[code]#
# Customize Plex's config
[Service]
Environment="PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR=/data/plexdata/Library/Application Support"
#
#  These values are only needed if you wish to change user & group
User=plex
Group=plex
#
# This is needed to change the default umask
UMask=0002    # this must be 4 digits of octal[/code]

after ctrl+X
it propose me to save as

[code] /etc/systemd/system/plexmediaserver.service.d/.#override.confd14c0668cfed0a1d[/code]

is it true ? or i must rename as “override.conf” or “.override.conf” ?

thx again and again for your help ^^

MODERATOR EDIT
Note:
use
```
something
```

the words [code] don’t work

You must use

/etc/systemd/system/plexmediaserver.service.d/override.conf

Hello @ChuckPa, thanks for the guide in Moving PMS 'Library'
I have followed the steps but i can’t make it work…
Could be any trouble if the new destination is on another disc? I want to move it to a NAS where i have more space…
The NAS is holding the plex media and that is working fine (if the server works with the original folder in /var/lib/plexmediaserver/)

Please tell me where things are and also show me how you’ve configured the override.conf file.

I’ll help you with any corrections and then the things to check. (with commands)

Great.

I have my data (series, movies) on a NAS. Which is 192.168.1.73.
I share everything through NFS.
I mount a share on my raspberry pi (which has PMS installed on it) through NFS in /etc/fstab
192.168.1.73:/mnt/HD/HD_a2/multimedia /media/multimedia nfs auto,rw,_netdev

Until here, everything works fine. I added my movies and series pointing to that folder without problems.

But the problem is the Library folder, is growing very fast. If it is in the default folder /var/lib/plexmediaserver it means that is on the SD card of the raspberry and there is no big space left there.

So i wanted to move the Library to the NAS.

I mounted another share that points to:
192.168.1.73:/mnt/HD/HD_a2/plexdata /home/pi/plexdata nfs auto,rw,_netdev 0 0

And i’ve made a copy of Library folder into it.
I also chown that folder to plex:plex.

Then i created the file override.conf as you said with: sudo systemctl edit plexmediaserver, and this content:

# 
# Customize Plex's config
[Service]
Environment="PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR=/home/pi/plexdata/Library/Application Support"
#
#  These values are only needed if you wish to change user & group
#User=chuck
#Group=strange
#
# This is needed to change the default umask 
#UMask=0002    # this must be 4 digits of octal

I exit and save the file, although it asked me for saving with a name like .#override.confc422e768c726a120, it creates a override.conf file with the same content.

Then, reload the service with: sudo systemctl daemon-reload
After that, I start the service: sudo systemctl start plexmediaserver.service

The service starts ok, no errors, but the web page is not available.

I also have noticed that once the service is running with the modifications, the status is:

sudo systemctl status plexmediaserver.service:

● plexmediaserver.service - Plex Media Server
   Loaded: loaded (/lib/systemd/system/plexmediaserver.service; enabled; vendor preset: enabled)
  Drop-In: /etc/systemd/system/plexmediaserver.service.d
           └─override.conf
   Active: active (running) since Fri 2020-06-05 00:03:21 CEST; 10min ago
 Main PID: 9361 (Plex Media Serv)
    Tasks: 5 (limit: 1718)
   Memory: 6.9M
   CGroup: /system.slice/plexmediaserver.service
           └─9361 /usr/lib/plexmediaserver/Plex Media Server

Jun 05 00:03:21 raspberrypi systemd[1]: Starting Plex Media Server...
Jun 05 00:03:21 raspberrypi systemd[1]: Started Plex Media Server.
Jun 05 00:05:05 raspberrypi systemd[1]: plexmediaserver.service: Current command vanished from the unit file, execution of the command list won't be resumed.

I think the agents are not running, and maybe something else?

you have something else going on. This is not good.

Jun 05 00:05:05 raspberrypi systemd[1]: plexmediaserver.service: Current command vanished from the unit file, execution of the command list won’t be resumed.

That is the thing. When i modify the service with the override, it doesn’t start right.

If I reboot the system, the status of the service is ok, but it doesn’t start other PID’s.

Here a status of the service WITHOUT the override:

● plexmediaserver.service - Plex Media Server
   Loaded: loaded (/lib/systemd/system/plexmediaserver.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2020-06-05 07:58:14 CEST; 10s ago
  Process: 2428 ExecStartPre=/bin/sh -c /usr/bin/test -d "${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}" || /bin/mkdir -p "${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DI
 Main PID: 2431 (Plex Media Serv)
    Tasks: 76 (limit: 1718)
   Memory: 109.0M
   CGroup: /system.slice/plexmediaserver.service
           ├─2431 /usr/lib/plexmediaserver/Plex Media Server
           ├─2458 Plex Plug-in [com.plexapp.system] /usr/lib/plexmediaserver/Resources/Plug-ins-69560ce1e/Framework.bundle/Contents/Resources/Versions/2/Python/boot
           ├─2497 /usr/lib/plexmediaserver/Plex DLNA Server
           ├─2503 /usr/lib/plexmediaserver/Plex Tuner Service /usr/lib/plexmediaserver/Resources/Tuner/Private /usr/lib/plexmediaserver/Resources/Tuner/Shared 1.19.
           └─2550 Plex Plug-in [com.plexapp.agents.imdb] /usr/lib/plexmediaserver/Resources/Plug-ins-69560ce1e/Framework.bundle/Contents/Resources/Versions/2/Python

Jun 05 07:58:14 raspberrypi systemd[1]: Starting Plex Media Server...
Jun 05 07:58:14 raspberrypi systemd[1]: Started Plex Media Server.

And now the result with the override.conf enabled:

● plexmediaserver.service - Plex Media Server
   Loaded: loaded (/lib/systemd/system/plexmediaserver.service; enabled; vendor preset: enabled)
  Drop-In: /etc/systemd/system/plexmediaserver.service.d
           └─override.conf
   Active: active (running) since Fri 2020-06-05 07:51:23 CEST; 1min 14s ago
  Process: 1884 ExecStartPre=/bin/sh -c /usr/bin/test -d "${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}" || /bin/mkdir -p "${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DI
 Main PID: 1886 (Plex Media Serv)
    Tasks: 4 (limit: 1718)
   Memory: 6.5M
   CGroup: /system.slice/plexmediaserver.service
           └─1886 /usr/lib/plexmediaserver/Plex Media Server

Jun 05 07:51:23 raspberrypi systemd[1]: Starting Plex Media Server...
Jun 05 07:51:23 raspberrypi systemd[1]: Started Plex Media Server.

I don’t understand why the service behave different just for overriding a environment variable…

Any ideas?

Please show me the override.conf file ?

Did you check to ensure the UID/GID of the new directory matches what’s specified in the override?

This is the whole service details:
sudo systemctl cat plexmediaserver.service :

# /lib/systemd/system/plexmediaserver.service
[Unit]
Description=Plex Media Server
After=network.target network-online.target

[Service]
Environment="PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR=/var/lib/plexmediaserver/Library/Application Support"
Environment=PLEX_MEDIA_SERVER_HOME=/usr/lib/plexmediaserver
Environment=PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS=6
Environment=PLEX_MEDIA_SERVER_TMPDIR=/tmp
ExecStartPre=/bin/sh -c '/usr/bin/test -d "${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}" || /bin/mkdir -p "${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}"'
ExecStart=/bin/sh -c '\
export PLEX_MEDIA_SERVER_INFO_VENDOR="$(grep ^NAME= /etc/os-release | awk -F= "{print \\$2}" | tr -d \\" )"; \
export PLEX_MEDIA_SERVER_INFO_DEVICE="PC"; \
export PLEX_MEDIA_SERVER_INFO_MODEL="$(uname -m)"; \
export PLEX_MEDIA_SERVER_INFO_PLATFORM_VERSION="$(grep ^VERSION= /etc/os-release | awk -F= "{print \\$2}" | tr -d \\" )"; \
export LD_LIBRARY_PATH=/usr/lib/plexmediaserver/lib; \
exec "/usr/lib/plexmediaserver/Plex Media Server"'
Type=simple
User=plex
Group=plex
Restart=on-failure
RestartSec=5
StartLimitInterval=60s
StartLimitBurst=3
SyslogIdentifier=Plex Media Server
StandardOutput=journal
StandardError=journal

[Install]
WantedBy=multi-user.target

# /etc/systemd/system/plexmediaserver.service.d/override.conf
#
# Customize Plex's config
[Service]
Environment="PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR=/home/pi/plexdata/Library/Application Support"
#
#  These values are only needed if you wish to change user & group
#User=chuck
#Group=strange
#
# This is needed to change the default umask 
#UMask=0002    # this must be 4 digits of octal

And the permissions of the folder:
ls -l /home/pi:

drwxr-xr-x  2 pi   pi     4096 Apr 21 22:07 Desktop
drwxr-xr-x  3 pi   pi     4096 May 15 20:09 Documents
drwxr-xr-x  2 pi   pi     4096 Apr 21 22:07 Downloads
drwxr-xr-x  2 root root   4096 Apr 21 22:06 MagPi
drwxr-xr-x  2 pi   pi     4096 Apr 21 22:08 Music
drwxr-xr-x 11 pi   pi     4096 May 17 09:42 my-sickbeard-install
drwxr-xr-x  2 pi   pi     4096 Apr 21 22:08 Pictures
drwxrwxrwx  3 plex plex   4096 Jun  3 18:23 plexdata
drwxr-xr-x  2 pi   pi     4096 Apr 21 22:08 Public
drwxr-xr-x  2 pi   pi     4096 Apr 21 22:08 Templates
-rwxr-xr-x  1 pi   pi   213272 Nov 12  2011 unrar
drwxr-xr-x  2 pi   pi     4096 Apr 21 22:21 Videos

And inside the folder:

ls -l /home/pi/plexdata/:

drwxr-xr-x 3 plex plex 4096 Jun  3 18:25 Library

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