alekdavis/PlexBackup

My PlexAppDataDir is not default C:\Users\MyName\Appdata can it be changed in the config?

Wormhole42 opened this issue · 7 comments

Hi, I'm trying to setup a backup to run on occasion with this script. I don't know powershell very well but have been building PC's for 20+ years. This is my like 6th iteration of a my Plex Server and I have a large drivepool setup using Stablebit Drivepool for all my media. I also have a larger 2TB drive that I store my main Plex Media Server folder that I had to mod the registry to point to since my OS is on a 128GB SSD and there's no room for all of the plex database data on it.
So what I've done is switched the location of the Plex Media Server to the N: drive which is not in the drivepool.
The default dir in the script or config file is $env:LOCALAPPDATA\Plex Media Server and I want to change this so it will point to N:\Local\Plex Media Server\Plug-in Support\Databases
Can this be done? Or should I just upgrade my OS drive to a larger 1TB SSD?
Right now I'm having to restore my databases to an earlier backup from last Oct since I had a system crash and it corrupted the database file.
I also have scheduled tasks to do a backup every 3 days but for some reason it never does and that's why I'm having to redo all my metadata that's changed or updated since Oct last year. I've done so much work manually making my plex media look how I want it and now I have to redo it. So I thought setting up this script would help me automate those tasks so I don't lose anything like this again. It's such a pain. lol
Thank you for creating this script to begin with I'm sure once I get it setup and running I will be reasonably worry free.
Cheers!

Hmmm... I'm not sure what you meant by:

The default dir in the script or config file is $env:LOCALAPPDATA\Plex Media Server and I want to change this so it will point to N:\Local\Plex Media Server\Plug-in Support\Databases

Normally, Plex Media Server\Plug-in Support\Databases is a subfolder under the Plex Media Server app data directory. Generally, yes, you can overwrite the default via the PlexAppDataDir parameter (command line or config file), but again, I'm not sure what you're trying to do here. If you said that your Plex app data dir is somewhere else, like N:\Local\Plex Media Server, then it would make more sense. But regardless, in the long term, I'd upgrade the hard drive to something like 256GB, which should be enough for most. It would save you headaches in future (and SSDs are not expensive these days).

Yes that's exactly it. My Plex server media dir is in N:\Local\Plex Media Server and not in $env:LOCALAPPDATA\Plex Media Server as it says in the script of the config file you created. I had to edit the registry for Plex to point to that dir due to storage constraints.
So if I wanted to change $env:LOCALAPPDATA\Plex Media Server to point instead to N:\Local\Plex Media Server, how would I do that? Is that even possible?
In the meantime I will consider getting a bigger SSD for my OS but it will be a pain to reinstall Windows and the Stablebit Drivepool software that needs to be deactivated and reactivated on the new install because of the software license. Once I do get it reinstalled it shouldn't be too difficult to get the drivepool set back up. It will find all of the drives in the pool and remeasure the data but I would want to still at least backup the databases to another drive.
Thank you for answering so quickly. It's much appreciated.

Just specify path to your custom directory via the PlexAppDataDir parameter, like

.\PlexBackup.ps1 -PlexAppDataDir "N:\Local\Plex Media Server" ...

Should be simple.

Ok I will try that. I'm running a manual backup right now of the whole Plex Media Server to an external hard drive. I started it last night and it's over 100GB so it's going to take a long time. Once it's done I'll try to modify the config as you suggested and see if it'll compress it and make the backup smaller. I will let you know. Thanks

Will I replace the whole line as you suggested as such?
This is your script
},
"PlexAppDataDir": {
"_meta": {
"default": "$env:LOCALAPPDATA\Plex Media Server"

So I will make it look like this?
},
"PlexAppDataDir": {
"_meta": {
"default": "N:\Local\Plex Media Server"

I tried that initially but it didn't work, but I will try again once this manual backup finishes.
Thanks

"PlexAppDataDir": {
    "_meta": {
        "default": "$env:LOCALAPPDATA\\Plex Media Server"
    },
    "value": "N:\\Local\\Plex Media Server"
},

Oh okay. Thanks!
My manual backup took for freaking ever.
So I went ahead and got a 1TB SSD and reinstalled everything. Now I'm in the process of moving the stuff from N: Plex to the default in the users appdata. Hopefully once it's all done moving I'll be able to run your script the way it's supposed to be to another new 1TB SSD I have coming and can just continue to make backups to it in the future. Migrating data takes way too long and this is very annoying. Hopefully when it's all done my server will not need much maintenance in the future.
I appreciate your help though! Thanks so much for your input/help.