This guide does not fall under support, use at your own risk. You can create a thread in our discord channel [#📚・tc-scale-apps](https://discord.gg/a5fj3FJ9Mx) for basic support for the guide itself.
:::
This guide will walk you through on migrating your plex config data from an _old_ to a new plex instance.
The first thing you need to do is go to **settings** and then **Library**.
- Disable `Empty trash automatically after every scan` checkbox if its enabled.
Go to **Settings** -> **General** and `Sign Out` of your server completely.
In TrueNAS Scale, go to **Apps** -> **Installed Applications** and stop the _old_ app.
Follow the sub section depending on how your app config was stored.
- App config on PVC -> [Backing up App Data From PVC](#migrating-data-from-pvc)
- App config on HostPath -> [Accessing App Data From HostPath](#migrating-data-from-hostpath)
- App config on HostPath(ix-applications) -> [Migrating App Data From IxVolumes](#migrating-data-from-ixvolumes)
## Dataset Permissions
This is our default perms for our plex app. Please make sure to keep plex perms set to `568`.
To access the old app's data from **PVC**, we are going to use [**heavyscript**](https://github.com/Heavybullets8/heavy_script#how-to-install) `mount` flag.
To mount the directory to your root pool just enter the correct number...so for me I have to enter `3`. Verify the number you are entering is for root.
Please move on to [Migrating App Data to the New App](#migrating-app-data-to-the-new-app).
## Migrating Data from HostPath
If your plex config is available on your own dataset, validate its [perms](#dataset-permissions).
Follow the prerequisites and then uninstall the original app. If the perms are good you can move on to [migrating to the new app](#migrating-app-data-to-the-new-app).
### Migrating Data from ixVolumes
This section is only for the official app where users didn't specify their own hostpath.
You should see an output like so -> `/mnt/POOL/ix-applications/releases/plex/volumes/ix_volumes/ix-plex_config/Library/Application Support/Plex Media Server/Preferences.xml`
We are only interested for this location as its the start of the config dir for plex -> `/mnt/POOL/ix-applications/releases/plex/volumes/ix_volumes/ix-plex_config/Library`.
Create a temp dataset in **Storage** -> **Datasets** for your old app plex config with the follow [perms](#dataset-permissions).
Go back to the system shell and replace this command's path with your **OWN**`path`, `pool` and `dataset` name.
This process can a while to complete depending on how large your config is and how your pools are setup. Make sure scale doesn't time out, simply keep the tab active and interact with the page menu top right will suffice until its done.
:::
If the operation completed successfully you can run the following commands to unmount the PVC.
Before you start the new plex app edit the app and add your media via additional storage with the correct **mountpath** from the original app and update any variables as needed.
The official app from scale use the `/data` path for media, but you could have used an entirely different dir for it.
I highly recommend setting up the variable `Plex Claim Token` last as it has a 4 min window.
To get a claim token from plex, go to [Plex Claim Token](https://plex.tv/claim).
Once set, save and wait a min for the task to finish and then start the app.
The app will take some time to migrate the db after startup and rest assured its normal to see something like this:
![error 503](./img/plex-503-error.png)
---
You should now be able to access plex's web service as normal with all your data intact, sign in if needed.
You can remove the temp dataset that holds your plex config as its not needed anymore.