Skip to main content

Part 5 - Restoring the Plex database

Now that you finished Part 4 - Restoring Rclone and Plexdrive configuration, all that is needed is restore the Plex database - and you won't even notice your server has changed.

There are a few things to check first.

Check mount

Before you proceed, make absolutely sure that the drive you use with Plex is properly mounted. Especially Plexdrive can take a while to build the cache - and you don't want Plex to think all your movies and tv shows have disappeared!

If you use the switch script as outlined in Part 6 of the first tutorial, make sure you run that after the reboot to mount the drive to your preferred location.

If you followed that guide to the letter, there are three possible locations where your Plex mount points to - only you know which of the options you chose, so I'll just cover all three here and let you pick the one that fits your setup.

Log into PuTTY with your own user to check whether Plex is ready to be restored.

If just just setup your Plex server to use Rclone, make sure that you see your Google files when you run

ls /mnt/Gdrive

If you setup Plex to use Plexdrive, check by typing

ls /mnt/Plexdrive

If you followed the entire tutorial and are using the switch script (and really, you should!), then you need to verify if your files are located at

ls /home/Plex

All set? Ok, let's restore!

Creating the script

Create a new (empty) file in Notepad++. Make sure you change the bottom bar to show "Unix (LF)".

Paste the following into your file


# Stopping services

sudo systemctl stop plexpy.service
sudo service plexmediaserver stop

# Restore database

read -e -p "File name to restore: " -i "$(hostname).$(date +%F)" filename

sudo rclone copy Gdrive:/Backup/$filename.tar.bz2 /tmp --checksum --drive-chunk-size=64M -v

if [ -e "/tmp/$filename.tar.bz2" ]

  echo "$filename found, proceeding..."
  echo "$filename not found on Google"
  echo "Please check the correct name and try again"
  echo "Exiting script..."
  sudo rm /tmp/restore-plexdb

# Replacing Plex vanilla with Plex backup

sudo mv /var/lib/plexmediaserver /var/lib/plexmediaserver-vanilla
sudo tar -xvf /tmp/$filename.tar.bz2 -C /

# Starting services

sudo chown -R plex:plex /var/lib/plexmediaserver
sudo service plexmediaserver start
sudo systemctl start plexpy.service

# Cleaning up

read -e -p "Remove vanilla Plex installation (Y/n)? " -i "Y" choice

case "$choice" in
  y|Y ) sudo rm -r /var/lib/plexmediaserver-vanilla;;
  * ) echo "Your old installation is available at /var/lib/plexmediaserver-vanilla";;

sudo rm /tmp/restore-plexdb
sudo rm /tmp/$filename.*
cd ~

# End message

echo ""
echo "================================="
echo " Your Plex database is restored  "
echo " Make sure your drive is mounted "
echo " Run the switch script manually! "
echo "================================="
echo ""

# To run this file copy the line below without the # and paste in PuTTY

# sudo wget -O /tmp/restore-plexdb && sudo chmod +x /tmp/restore-plexdb && /tmp/restore-plexdb

There actually isn't a lot to tweak here.  If you followed the Backup script instructions as mentioned in part 6 of the first tutorial, all you need to do is copy the correct Dropbox link into the file and you're good to go.

Probably needless to say, but you can find the exact name and date of the Plex backup script in Google:

You hope enjoyed my tutorial of your own personal turnkey restore process!