How to Backup Plex Data in Windows
For many users that maintain a Plex server, they usually have a backup plan in place to keep the data stored on their server safe. While your Plex Media Server may not be a critical application, it can be important to backup your Plex data.
Backing up your Plex server serves two purposes:
- It will allow you to restore your Plex server if something were to happen to your current server, such as a hard drive failure.
- If you change servers, you can use your backup as a means of moving your Plex Media Server to the new server.
For many people, the first option would be the most important reason for backing up their Plex server. Hard drives, and other hardware, can fail at any time, and having a backup of Plex will allow you to easily have your Plex server up and running again fairly quickly.
Keep in mind, however, that the steps outlined below won't backup your media files. Those you will need to backup yourself, if you choose to backup your media files.
Backing up your Plex Media Server
Backing up you Plex server in Windows requires backing up two locations:
- The Plex settings in the Windows registry.
- The files and folders in the data directory.
Let's look at backing up each of the two locations.
Backing up the Plex settings
The settings used by the Plex Media Server are stored in the Windows registry. The registry keys are located under the registry settings for the user that is running the Plex process in Windows.
To backup the registry settings, you can use one of two ways: using the Registry Editor, or through the command line.
Using the Windows Registry Editor
To use the Registry Editor to backup the Plex settings in the Windows registry, use the following steps:
- Log into Windows with the account that is running Plex.
- Type the Windows Key+R to open the Run dialog, and then type regedit.exe. The Registry Editor should be displayed.
- Navigate to the following key: HKEY_CURRENT_USER\SOFTWARE\Plex, Inc., and then right-click the key Plex, Inc..
- In the context menu, click the Export option, and then specify a location and file name for the registry file.
- Click the Save button to save the registry file. This registry file will now contain your Plex settings, which you can then backup to any location you wish.
From the command line
You can use the reg.exe application to backup the Plex registry settings. This can be done using the following command:
reg EXPORT "HKCU\SOFTWARE\Plex, Inc." "{reg_file_path}" /y
In the above command, replace {reg_file_path}
with the actual full path of the file that will contain the registry settings. The "/y" at the end will force overwriting of the file you specify in the command.
Backing up the Plex data directory
To backup the Plex data directory, it is simply a matter of making a copy of the directory that contains the Plex data. To backup the Plex data directory, use the following steps:
- First, locate the Plex data directory. The default location is the %LOCALAPPDATA%\Plex Media Server when logged in as the user running the Plex Media Server.
- Open Windows Explorer, and then navigate to the Plex data directory.
- Copy all the folders in the data directory to another location as the backup.
In addition to making a copy of the folders, you may also look at zipping up the entire data directory into a zip or similar compressed archive file to make transferring the data easier, as you will then only need to copy one large file instead of many smaller files.
Also, if you export the registry settings into your Plex data directory, you can then automatically backup both your data directory and the Plex settings with a single copy task.
The above steps outline how to backup both the Plex registry settings and the data directory in Windows. You can simply reverse the process to restore the Plex Media Server, either on the same Windows system, or in another Windows system, if you choose.
Basic backup batch file
You can create a simple batch file that can be used to backup your Plex configuration. The batch file will run the reg.exe application, followed by a robocopy command that will backup the entire Plex data directory, excluding unnecessary directories to save space.
The batch file is:
@echo off reg EXPORT "HKCU\SOFTWARE\Plex, Inc." "C:\Users\{user_id}\AppData\Local\Plex Media Server\plex.reg" /y robocopy "C:\Users\{user_id}\AppData\Local\Plex Media Server" "{backup_directory_path}" /mir /r:3 /w:5 /xd "C:\Users\{user_id}\AppData\Local\Plex Media Server\Cache" "C:\Users\{user_id}\AppData\Local\Plex Media Server\Crash Reports" "C:\Users{user_id}\AppData\Local\Plex Media Server\Logs" "C:\Users\{user_id}\AppData\Local\Plex Media Server\Updates" "C:\Users\{user_id}\AppData\Local\Plex Media Server\Media\localhost" /log:{log_path}
Replace the following placeholders with the actual value:
Placeholder | Value |
---|---|
user_id | The ID of the user running Plex Media Server. |
backup_directory_path | Full path to the destination directory where the files will be copied. |
log_path | Full path - including file name - of the log file. Will be created if the log file does not exist. |
The following folders will be excluded from the backup, as they are not needed and can be quite large:
- Cache
- Crash Reports
- Logs
- Updates
The batch file will first export the Plex settings from the Windows registry using reg.exe
and save the settings to a file in the data directory of Plex.
Next, the robocopy
command will run to mirror the data directory to a destination directory of my choosing. Since the registry settings were stored in a file in the data directory, they will also be mirrored to the destination directory.
You can schedule the batch file through Windows task scheduler, or another application you would like to use, to run the backup on a regular basis. I schedule mine to run and backup my Plex settings every morning.
Media backup
You may have noticed I haven't talked about backing up your media files. This will need to be done on a user-by-user basis. Each user will have a different amount of media files to backup, and some users have hundreds of terabytes.
When backing up your media, though, I don't recommend you use a cloud provider as many have storage restrictions too low, or it can get expensive to store terabytes of data.
There are also legal aspects to think about when storing media files in the cloud.
Restoring a Plex backup
To restore your backup, it is simply a matter of stopping Plex on the server, and copying the backed up data directory to the same location on the server - overwriting any directories and files.
For the settings, simply copy the file back to the original location (overwriting any existing file), or in the case of Windows, merge the registry data.
Once both the data directories and settings have been restored, restart the Plex Media Server.
Best backup practices
While backing up Plex is straightforward, having a good backup plan in place takes some more planning. A good backup plan follows the 3-2-1 backup rule:
- 3 copies of your data.
- 2 different types of media.
- 1 of the backups is stored offsite.
The above means that you should always have one primary copy of your Plex data, with two additional copies stored on different media, and one of those additional copies located offsite - a different geographical location.
This can be easy to solve by simply storing a backup copy of your data on another NAS or external hard drive. In addition, you should also copy the data to a NAS stored somewhere else, or store the data online, in the cloud.
My Plex data is backed up to another local hard drive, and then to another hard drive, I disconnect and swap with another hard drive every month.
Since my Plex server is on Windows, I use Backblaze as my cloud storage provider. I pay a flat monthly rate and currently have 1.6 TB stored in the cloud. This service works with both Windows and Macs.
For Linux or NAS users, Backblaze offers B2, an S3 equivalent, for which you pay for what you use. B2 is popular as it has a low price of $0.005 per gigabyte.
By knowing what Plex data you will need to backup, and having a good backup plan in place, you can protect your Plex data from being lost.