Change Metadata Location on Ubuntu 14.04

I just realized that Plex is taking up almost all of my 20 gig root partition and am struggling to change where PMS keeps it’s metadata to a partition with more space (/home).

https://support.plex.tv/hc/en-us/articles/200273978-Linux-User-and-Storage-configuration

This was the only info I was able to find but it doesn’t seem to apply to 14.04, although I did change the Plex systemd file to no effect (why does this file exist in 14.04 anyways?)

Anyone know where I should be looking?

The location of where Plex keeps its metadata is per-distribution specific and (kinda) hard set.

To move where the data actually does requires a bit of ‘system administration’ magic because the location is always under your ‘Library’ and, in this case, Ubuntu has Library in /var/lib/plexmediaserver.

Fear not. Linux is VERY flexible and even Plex can be ‘convinced’ to think the data is where it belongs when it isn’t. The same technique used for network shares will be used for Plex. Watch very carefully as my fingers never leave my hands. :slight_smile:

First, put systemd back to how it was initially. There is no need (ever) to fuss with it.

Now:

  1. start a root shell for all the following commands: sudo /bin/sh (or your favorite shell)

  2. stop plex

  3. create new location for Plex’s library ( I will use /home/plex in this example )

    mkdir /home/plex ; chown plex.plex /home/plex ; chmod 755 /home/plex

  4. copy the Library and place it in /home/plex (this will take some time)

    cd /var/lib/plexmediaserver
    tar cf - . | (cd /home/plex ; tar xf -)

  5. when copy completes, verify no files skipped and the size of both directories is the same

    find /home/plex -print | wc -l
    find /var/lib/plexmediaserver | wc -l
    du -ms /home/plex
    du -ms .

  6. Remove the old Library

    rm -rf /var/lib/plexmediaserver/*

  7. go to /etc

    cd /etc

  8. make the loopback (bind) mount

mount -o bind /home/plex /var/lib/plexmediaserver

9 verify Plex’s directory structure is there as it was prior and you can see no difference navigating or access-wise

  1. Start Plex and verify all operates as before

11 When verified, make the ‘mount’ permanent in /etc/fstab so it is always done before Plex is started during system boot

  1. Using your favorite editor (gedit / vi), add this line, as given, just below where your main OS partitions are listed.

/home/plex /var/lib/plexmediaserver bind defaults 0 0

When done, it should look similar to the /etc/fstab below

    #
    # /etc/fstab
    # Created by anaconda on Fri Nov 20 03:33:02 2015
    #
    # Accessible filesystems, by reference, are maintained under '/dev/disk'
    # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
    #
    UUID=61c69632-5a87-400e-86ba-1423c22e59ea /                       ext4    defaults        1 1
    UUID=2d570d79-8b8c-46bd-bed6-fdf50e4037c7 /boot                   ext4    defaults        1 2
    UUID=b8f7f828-458c-4e61-9baf-43340f0a46af /home                   ext4    defaults        1 2
    UUID=4fb8038d-c38b-4aa8-ae8a-4d77f89a401c swap                    swap    defaults        0 0
    
    # Plex relocation mount
    /home/plex                               /var/lib/plexmediaserver       bind  defaults         0 0
10 Likes

this kind of information is valuable … it teaches more than just resolving this particular issue , thanks for the well detailed instruction and explanation of the "how’s and why’s "

Glad I could help!

Hi thanks for sharing this when I do the copy command Im getting Cant Open : Permission Denied any clue how to fix it?

Since this thread was last active (it should have been closed ),

I have created a How-To for moving PMS’ Library on Linux. Of interest to you will be the section for init-based systems.