Plex Server Installed On Micro SD (SBC). How can I reduce writes to Micro SD?

Server Version#: 1.41.3.9314
Player Version#: 4.144.1

I recently helped setup a Plex on a SBC for a friend of mine. The setup is as follows:

Hardware: Odroid C2
OS: Armbian Debian 12
OS Drive: micro sd 64 GB
USB Drive: 4 TB SATA (mounted to /mnt/hdd)

Plex Media Server is installed on the micro sd. I would like to uptimize the plex / system to reduce the file writes to the micro sd. Does anyone have some simple plex configurations changed that would reduce writing?

I have already done the following:

  • Disabled Plex Media Server debug and verbose logging. Less data is logged reducing disk writes
  • Set the Scheduled Task Backup Directory to my external drive: /mnt/hdd/backup/plex/db. My databases are currently around 250 MB in size. That means 250 MB of reduced micro sd writing every 3 days, right?

Would it be possible to move the /var/lib/plexmediaserver to an external drive and then use a symobolic link? I am pretty sure that is possible but if plex starts before the external mounts then that would be bad. Steps would be something like:

  • Stop plex
  • copy /var/lib/plexmediaserver to external /mnt/hdd/backup/plex/plexmediaserver
  • delete /var/lib/plexmediaserver
  • create symbolic link … linkname: /var/lib/plexmediaserver to target: /mnt/hdd/backup/plex/plexmediaserver

Thoughts? Other recommendations?

You can move the PMS_APP_SUPP_DIR to the external drive by using the systemd override.conf mechanism.

The symlink is not 100% safe/reliable. Override.conf is best.

You can customize a few other things about it too.

Take a look here

Example. (My /usb is an external M.2 SSD mounted as “/usb”. )

[chuck@lizum ~.2002]$ cat /etc/systemd/system/plexmediaserver.service.d/override.conf 
[Service]
Environment="PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR=/usb/plex"
User=chuck
Group=chuck
[chuck@lizum ~.2003]$ 

I stopped plex, Copied the data (as root) using tar | tar then a chown after the fact. Done :slight_smile:

@ChuckPa, that sounds perfect. Thank you.

The plex media (movies, music) is already on /mnt/hdd/plex so that seems like a good spot for PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR.

So this change would result in the directories movies, music and ‘Plex Media Server’ under /mnt/hdd/plex like so:

/mnt/hdd/plex

  • movies
  • music
  • ‘Plex Media Server’

Setup steps would include:

1.) Stop PMP

sudo systemctl stop plexmediaserver

2.) Copy existing ‘Application Support Directory’

tar -cf /mnt/hdd/backup/PlexAppSupportDir.tar -C '/var/lib/plexmediaserver/Library/Application Support' 'Plex Media Server’

tar -xf /mnt/hdd/backup/PlexAppSupportDir.tar -C /mnt/hdd/plex

3.) chown /mnt/hdd/plex so it is owned by user / group

sudo chown -R kyle:kyle /mnt/hdd/plex

4.) Create a /etc/systemd/system/plexmediaserver.service.d/override.conf with the following settings

[Service]
Environment="PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR=/mnt/hdd/plex"
User=kyle
Group=kyle

5.) Reinstall PMS. This will verify override.conf settings and add configured User & Group into udev rules (for hardware transcoding).

sudo apt-get reinstall plexmediaserver

Verify output contains the following two lines:
. Config file used: /etc/systemd/system/plexmediaserver.service.d/override.conf
. Installation successful. Errors: 0, Warnings: 0

6.) Start PMS

sudo systemctl start plexmediserver

7.) mount /mnt/hdd during boot via /etc/fstab with this configuration

UUID=945255a8-082e-425d-8f28-6d484d7c27ee /mnt/hdd ext4 defaults 0 0

8.) Delete original Plex Application Support Directory

sudo rm -fr /var/lib/plexmediaserver

?? Same username ??

why not your username?

Sorry, I thought it would be better to finish your example instead of introducing new ingredients along the way. I am setting this up for my friend Kyle. So the settings will be:

User=kyle
Group=kyle

sudo chown -R kyle:kyle /mnt/hdd/plex

Thanks for clarifying.

I didn’t want you to blindly copy my example.

As long as you know what to do and how it works :+1:

I would have understood the customization without explanation.

You should confirm his user and group id kyle to confirm user and group exist

[chuck@lizum ~.2000]$ id chuck
uid=1000(chuck) gid=1000(chuck) groups=1000(chuck),xxxxxxxxxxxxxxxxk
[chuck@lizum ~.2001]$ 

Don’t forget to give the PMS package a quick reinstall -OR- manually add ‘kyle’ to the group which owns /dev/dri (for HW transcoding)

It sounds like a PMP package reinstall is the easier option here. I am assuming this means I do the following, right?

sudo apt-get reinstall plexmediaserver

I wrote the debian package scripts.

The most important part of the reinstall is the confirming the configuration is set

  1. preinst - picks up the customizations from override.conf
  2. postinst - uses those customizations to confirm you have a runnable config
    – and the User & Group are configured into udev rules (for HW transcoding)

You can do it manually if you wish but reinstall is non-destructive.

Every time you install an update, postinst runs to confirm the configuration is viable.

Not sure how PMP comes into this. PMP is the player. What you’re doing is the server side.

I will confirm the user kyle is created as well. I updated my steps above to include reinstall. Can you please check to make sure I didn’t skip a step? I followed the steps and everything seems correct to me.

How would I check?

I can’t see any local configuration information other than the IP address.

I have adjusted my install steps to include PMS reinstall and verification steps. Should I change any of these steps? Did I skip something that is required?

Setup steps

1.) Stop PMP

sudo systemctl stop plexmediaserver

2.) Copy existing ‘Application Support Directory’

tar -cf /mnt/hdd/backup/PlexAppSupportDir.tar -C '/var/lib/plexmediaserver/Library/Application Support' 'Plex Media Server’

tar -xf /mnt/hdd/backup/PlexAppSupportDir.tar -C /mnt/hdd/plex

3.) chown /mnt/hdd/plex so it is owned by user / group

sudo chown -R kyle:kyle /mnt/hdd/plex

4.) Create a /etc/systemd/system/plexmediaserver.service.d/override.conf with the following settings

[Service]
Environment="PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR=/mnt/hdd/plex"
User=kyle
Group=kyle

5.) Reinstall PMS. This will verify override.conf settings and add configured User & Group into udev rules (for hardware transcoding).

sudo apt-get reinstall plexmediaserver

Verify output contains the following two lines:
. Config file used: /etc/systemd/system/plexmediaserver.service.d/override.conf
. Installation successful. Errors: 0, Warnings: 0

6.) Start PMS

sudo systemctl start plexmediaserver

7.) mount /mnt/hdd during boot via /etc/fstab with this configuration

UUID=945255a8-082e-425d-8f28-6d484d7c27ee /mnt/hdd ext4 defaults 0 0

8.) Delete original Plex Application Support Directory

sudo rm -fr /var/lib/plexmediaserver

There is only one thing I do in the tar sequence which is generally faster and makes more sense to me.

This requires the new destination (PMS home) to be mounted and available – reasonable expectation.

sudo bash
cd /var/lib/plexmediaserver
tar cf - . | (cd /new/pms/location ; tar xf - )

The last step here is the override.conf line:

Environment="PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR=/new/pms/location/Library/Application Support"
  1. the tar cf copies the Library / Application Support / Plex Media Server / ...
  2. the tar xf writes what it got from tar cf
  3. since this is a ‘copy’, we have the same top level directories in the new location.

:slight_smile:

Awesome. I think that answers all my questions. I applied these changes to my server and it worked very well. Thank you.

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