Switch UnionFS Cloud Share Between ACD & GDrive

For all of you syncing your ACD and GDrive (and the sync is already completed), I’ve compiled a little bash to make a way to quickly move your UnionFS from one to the other. Just put a file called ACDSecureTest.txt on your ACD drive, and another one called GDriveSecureTest.txt on your GDrive.

#!/bin/bash

#This script will switch the ACDSecure drive and the GDriveSecure drive in the UnionFS Mount.
#
#Define your mount points here
#
GDriveSecure="/mnt/disks/GDriveSecure"
ACDSecure="/mnt/disks/ACDSecure"
UnionFS="/mnt/disks/UnionFS"
StagingFolder="/mnt/user/Media/Staging"

#
#Begin GDriveSecure Test, then switch to ACDSecure, and test.
#
if [[ -f $UnionFS/GDriveSecureTest.txt ]]; then
   echo "$(date "+%d.%m.%Y %T") INFO: GDriveSecure mounted to UnionFS.  Remounting UnionFS to ACDSecure." | tee -a "/var/log/acd-check.log"
   fusermount -u $UnionFS
   fusermount -u -z $UnionFS
   umount -f $UnionFS
   umount -l $UnionFS
   sleep 2
   	mkdir -p $UnionFS/
       sleep 2
       unionfs \
           -o cow,allow_other,direct_io,auto_cache,sync_read,nonempty,hide_meta_files \
           $StagingFolder=RW:$ACDSecure=RO \
           $UnionFS/
   sleep 2
      if [[ -f $UnionFS/ACDSecureTest.txt ]]; then
         echo "$(date "+%d.%m.%Y %T") INFO: ACDSecure Remount successful" | tee -a "/var/log/acd-check.log"
      else
         echo "$(date "+%d.%m.%Y %T") CRITICAL: ACDSecure Remount failed." | tee -a "/var/log/acd-check.log"
      fi
else
   echo "$(date "+%d.%m.%Y %T") GDriveSecure not currently mounted to UnionFS." | tee -a "/var/log/acd-check.log"
   #
   #Begin ACDSecure Test, then switch to GDriveSecure, and test.
   #
   if [[ -f $UnionFS/ACDSecureTest.txt ]]; then
      echo "$(date "+%d.%m.%Y %T") INFO: ACDSecure mounted to UnionFS.  Remounting UnionFS to GDriveSecure." | tee -a "/var/log/acd-check.log"
      fusermount -u $UnionFS
      fusermount -u -z $UnionFS
      umount -f $UnionFS
      umount -l $UnionFS
      sleep 2
      	mkdir -p $UnionFS/
          sleep 2
          unionfs \
              -o cow,allow_other,direct_io,auto_cache,sync_read,nonempty,hide_meta_files \
              $StagingFolder=RW:$GDriveSecure=RO \
              $UnionFS/
      sleep 2
         if [[ -f $UnionFS/GDriveSecureTest.txt ]]; then
            echo "$(date "+%d.%m.%Y %T") INFO: GDriveSecure Remount successful" | tee -a "/var/log/acd-check.log"
         else
            echo "$(date "+%d.%m.%Y %T") CRITICAL: GDriveSecure Remount failed." | tee -a "/var/log/acd-check.log"
         fi
   else
      echo "$(date "+%d.%m.%Y %T") ACDSecure not currently mounted to UnionFS." | tee -a "/var/log/acd-check.log"
   fi
fi
echo "It is done."
exit

Edit: As I’ve had some input from those here, I’ve compiled a few new scripts to assist in this:

#!/bin/bash
#
#This script will test your mount points and make sure they are remounted if they should fail.  If one fails, it will switch the UnionFS to the other, but not modify should the other be okay.

#Define your mount points here:
GDriveSecure="/mnt/disks/GDriveSecure"
ACDSecure="/mnt/disks/ACDSecure"
UnionFS="/mnt/disks/UnionFS"
StagingFolder="/mnt/user/Media/Staging"
PMSAppData="/mnt/user/appdata/PlexMediaServer"
#
#Begin GDriveSecure Test
#
if [[ -f "$GDriveSecure/GDriveSecureTest.txt" ]]; then
   echo "$(date "+%d.%m.%Y %T") INFO: Check successful, GDriveSecure mounted" | tee -a "/var/log/acd-check.log"
else
   echo "$(date "+%d.%m.%Y %T") ERROR: GDriveSecure not mounted remount in progress" | tee -a "/var/log/acd-check.log"
   if [[ -f "$UnionFS/ACDSecureTest.txt" ]]; then
       echo "$(date "+%d.%m.%Y %T") INFO: Check successful, ACDSecure mounted to UnionFS" | tee -a "/var/log/acd-check.log"
   else
       echo "$(date "+%d.%m.%Y %T") ERROR: ACDSecure not mounted to UnionFS. Remount in progress" | tee -a "/var/log/acd-check.log"
	   	fusermount -u $UnionFS
        fusermount -uz $UnionFS
        umount -l $UnionFS
        umount -f $UnionFS
        mkdir -p $UnionFS
        sleep 2
        unionfs \
        -o cow,allow_other,direct_io,auto_cache,sync_read,nonempty,hide_meta_files \
        $StagingFolder=RW:$ACDSecure=RO \
        $UnionFS
		sleep 2
	    if [[ -f "$UnionFS/ACDSecureTest.txt" ]]; then
           echo "$(date "+%d.%m.%Y %T") INFO: ACDSecure Remount to UnionFS successful" | tee -a "/var/log/acd-check.log"
        else
           echo "$(date "+%d.%m.%Y %T") CRITICAL: ACDSecure Remount to UnionFS failed." | tee -a "/var/log/acd-check.log"
        fi
        #This will restore any items that may have accidentally gotten trashed during the last mount failure.
        sqlite3 $PMSAppData/Library/Application\ Support/Plex\ Media\ Server/Plug-in\ Support/Databases/com.plexapp.plugins.library.db "UPDATE metadata_items set deleted_at=null"
   fi
   fusermount -u $GDriveSecure
   fusermount -uz $GDriveSecure
   umount -l $GDriveSecure
   umount -f $GDriveSecure
   sleep 2
   rclone mount \
    	--allow-non-empty \
    	--allow-other \
		--dir-cache-time 60m \
    	--max-read-ahead 4G \
    	--buffer-size 1G \
    	--contimeout 15s \
    	--low-level-retries 1 \
    	--no-check-certificate \
    	--quiet \
    	--stats 0 \
    	--retries 10 \
    	--timeout 10s \
		--log-file=/mnt/user/appdata/PlexMediaServer/mount.log \
		GDriveSecure:/ $GDriveSecure &
   sleep 2
   if [[ -f "$GDriveSecure/GDriveSecureTest.txt" ]]; then
      echo "$(date "+%d.%m.%Y %T") INFO: GDriveSecure Remount successful" | tee -a "/var/log/acd-check.log"
	  	mkdir -p $UnionFS
        sleep 2
        unionfs \
        -o cow,allow_other,direct_io,auto_cache,sync_read,nonempty,hide_meta_files \
        $StagingFolder=RW:$GDriveSecure=RO \
        $UnionFS
        #This will restore any items that may have accidentally gotten trashed during the last mount failure.
        sqlite3 $PMSAppData/Library/Application\ Support/Plex\ Media\ Server/Plug-in\ Support/Databases/com.plexapp.plugins.library.db "UPDATE metadata_items set deleted_at=null"
   else
      echo "$(date "+%d.%m.%Y %T") CRITICAL: GDriveSecure Remount failed." | tee -a "/var/log/acd-check.log"
   fi
fi
#
#Begin ACDSecure Test
#
if [[ -f "$ACDSecure/ACDSecureTest.txt" ]]; then
   echo "$(date "+%d.%m.%Y %T") INFO: Check successful, ACDSecure drive mounted" | tee -a "/var/log/acd-check.log"
else
   echo "$(date "+%d.%m.%Y %T") ERROR: ACDSecure Drive not mounted remount in progress" | tee -a "/var/log/acd-check.log"
   if [[ -f "$UnionFS/GDriveSecureTest.txt" ]]; then
       echo "$(date "+%d.%m.%Y %T") INFO: Check successful, GDriveSecure mounted to UnionFS" | tee -a "/var/log/acd-check.log"
   else
       echo "$(date "+%d.%m.%Y %T") ERROR: GDriveSecure not mounted to UnionFS. Remount in progress" | tee -a "/var/log/acd-check.log"
	   	fusermount -u $UnionFS
        fusermount -uz $UnionFS
        umount -l $UnionFS
        umount -f $UnionFS
        mkdir -p $UnionFS
        sleep 2
        unionfs \
        -o cow,allow_other,direct_io,auto_cache,sync_read,nonempty,hide_meta_files \
        $StagingFolder=RW:$GDriveSecure=RO \
        $UnionFS
		sleep 2
	    if [[ -f "$UnionFS/GDriveSecureTest.txt" ]]; then
           echo "$(date "+%d.%m.%Y %T") INFO: GDriveSecure Remount to UnionFS successful" | tee -a "/var/log/acd-check.log"
        else
           echo "$(date "+%d.%m.%Y %T") CRITICAL: GDriveSecure Remount to UnionFS failed." | tee -a "/var/log/acd-check.log"
        fi
        #This will restore any items that may have accidentally gotten trashed during the last mount failure.
        sqlite3 $PMSAppData/Library/Application\ Support/Plex\ Media\ Server/Plug-in\ Support/Databases/com.plexapp.plugins.library.db "UPDATE metadata_items set deleted_at=null"
   fi
   fusermount -u $ACDSecure
   fusermount -uz $ACDSecure
   umount -l $ACDSecure
   umount -f $ACDSecure
   sleep 2
   rclone mount \
    	--allow-non-empty \
    	--allow-other \
		--dir-cache-time 60m \
    	--acd-templink-threshold 0 \
    	--max-read-ahead 4G \
    	--buffer-size 1G \
    	--contimeout 15s \
    	--low-level-retries 1 \
    	--no-check-certificate \
    	--quiet \
    	--stats 0 \
    	--retries 10 \
    	--timeout 10s \
		--log-file=/mnt/user/appdata/PlexMediaServer/mount.log \
		ACDSecure:/ $ACDSecure &
   sleep 2
   if [[ -f "$ACDSecure/ACDSecureTest.txt" ]]; then
      echo "$(date "+%d.%m.%Y %T") INFO: ACDSecure Remount successful" | tee -a "/var/log/acd-check.log"
	  	mkdir -p $UnionFS
        sleep 2
        unionfs \
        -o cow,allow_other,direct_io,auto_cache,sync_read,nonempty,hide_meta_files \
        $StagingFolder=RW:$ACDSecure=RO \
        $UnionFS
        #This will restore any items that may have accidentally gotten trashed during the last mount failure.
        sqlite3 $PMSAppData/Library/Application\ Support/Plex\ Media\ Server/Plug-in\ Support/Databases/com.plexapp.plugins.library.db "UPDATE metadata_items set deleted_at=null"
   else
      echo "$(date "+%d.%m.%Y %T") CRITICAL: ACDSecure Remount failed." | tee -a "/var/log/acd-check.log"
   fi
fi
exit

Here is another one that combines most everything here:

#!/bin/bash

#This script will monitor the mount's LogFile, and switch the ACDSecure drive and the GDriveSecure drive in the UnionFS Mount when there is a "403 Forbidden" error.
#
#Define your mount points & logfile here:
#
GDriveSecure="/mnt/disks/GDriveSecure"
ACDSecure="/mnt/disks/ACDSecure"
UnionFS="/mnt/disks/UnionFS"
StagingFolder="/mnt/user/Media/Staging"
LOGFILE="/mnt/user/appdata/PlexMediaServer/mount.log"
PMSAppData="/mnt/user/appdata/PlexMediaServer"

tail -fn0 $LOGFILE | \
        while read line ; do
                echo "$line" | grep "403 Forbidden" # Could probably be a bit more specific, does this always imply ban?
                if [ $? = 0 ] ; then
                   sleep 5
				   #This script will test your mount points and make sure they are remounted if they should fail.  If one fails, it will switch the UnionFS to the other, but not modify should the other be okay.
                   
                   #Begin GDriveSecure Test
                   
                   if [[ -f "$GDriveSecure/GDriveSecureTest.txt" ]]; then
                      echo "$(date "+%d.%m.%Y %T") INFO: Check successful, GDriveSecure mounted" | tee -a "/var/log/acd-check.log"
                   else
                      echo "$(date "+%d.%m.%Y %T") ERROR: GDriveSecure not mounted remount in progress" | tee -a "/var/log/acd-check.log"
                      if [[ -f "$UnionFS/ACDSecureTest.txt" ]]; then
                          echo "$(date "+%d.%m.%Y %T") INFO: Check successful, ACDSecure mounted to UnionFS" | tee -a "/var/log/acd-check.log"
                      else
                          echo "$(date "+%d.%m.%Y %T") ERROR: ACDSecure not mounted to UnionFS. Remount in progress" | tee -a "/var/log/acd-check.log"
                   	   	fusermount -u $UnionFS
                           fusermount -uz $UnionFS
                           umount -l $UnionFS
                           umount -f $UnionFS
                           mkdir -p $UnionFS
                           sleep 2
                           unionfs \
                           -o cow,allow_other,direct_io,auto_cache,sync_read,nonempty,hide_meta_files \
                           $StagingFolder=RW:$ACDSecure=RO \
                           $UnionFS
                   		sleep 2
                   	    if [[ -f "$UnionFS/ACDSecureTest.txt" ]]; then
                              echo "$(date "+%d.%m.%Y %T") INFO: ACDSecure Remount to UnionFS successful" | tee -a "/var/log/acd-check.log"
                           else
                              echo "$(date "+%d.%m.%Y %T") CRITICAL: ACDSecure Remount to UnionFS failed." | tee -a "/var/log/acd-check.log"
                           fi
                           #This will restore any items that may have accidentally gotten trashed during the last mount failure.
                           sqlite3 $PMSAppData/Library/Application\ Support/Plex\ Media\ Server/Plug-in\ Support/Databases/com.plexapp.plugins.library.db "UPDATE metadata_items set deleted_at=null"
                      fi
                      fusermount -u $GDriveSecure
                      fusermount -uz $GDriveSecure
                      umount -l $GDriveSecure
                      umount -f $GDriveSecure
                      sleep 2
                      rclone mount \
                       	--allow-non-empty \
                       	--allow-other \
                   		--dir-cache-time 60m \
                       	--max-read-ahead 4G \
                       	--buffer-size 1G \
                       	--contimeout 15s \
                       	--low-level-retries 1 \
                       	--no-check-certificate \
                       	--quiet \
                       	--stats 0 \
                       	--retries 10 \
                       	--timeout 10s \
                   		--log-file=/mnt/user/appdata/PlexMediaServer/mount.log \
                   		GDriveSecure:/ $GDriveSecure &
                      sleep 2
                      if [[ -f "$GDriveSecure/GDriveSecureTest.txt" ]]; then
                         echo "$(date "+%d.%m.%Y %T") INFO: GDriveSecure Remount successful" | tee -a "/var/log/acd-check.log"
                   	  	mkdir -p $UnionFS
                           sleep 2
                           unionfs \
                           -o cow,allow_other,direct_io,auto_cache,sync_read,nonempty,hide_meta_files \
                           $StagingFolder=RW:$GDriveSecure=RO \
                           $UnionFS
                           #This will restore any items that may have accidentally gotten trashed during the last mount failure.
                           sqlite3 $PMSAppData/Library/Application\ Support/Plex\ Media\ Server/Plug-in\ Support/Databases/com.plexapp.plugins.library.db "UPDATE metadata_items set deleted_at=null"
                      else
                         echo "$(date "+%d.%m.%Y %T") CRITICAL: GDriveSecure Remount failed." | tee -a "/var/log/acd-check.log"
                      fi
                   fi
                   #
                   #Begin ACDSecure Test
                   #
                   if [[ -f "$ACDSecure/ACDSecureTest.txt" ]]; then
                      echo "$(date "+%d.%m.%Y %T") INFO: Check successful, ACDSecure drive mounted" | tee -a "/var/log/acd-check.log"
                   else
                      echo "$(date "+%d.%m.%Y %T") ERROR: ACDSecure Drive not mounted remount in progress" | tee -a "/var/log/acd-check.log"
                      if [[ -f "$UnionFS/GDriveSecureTest.txt" ]]; then
                          echo "$(date "+%d.%m.%Y %T") INFO: Check successful, GDriveSecure mounted to UnionFS" | tee -a "/var/log/acd-check.log"
                      else
                          echo "$(date "+%d.%m.%Y %T") ERROR: GDriveSecure not mounted to UnionFS. Remount in progress" | tee -a "/var/log/acd-check.log"
                   	   	fusermount -u $UnionFS
                           fusermount -uz $UnionFS
                           umount -l $UnionFS
                           umount -f $UnionFS
                           mkdir -p $UnionFS
                           sleep 2
                           unionfs \
                           -o cow,allow_other,direct_io,auto_cache,sync_read,nonempty,hide_meta_files \
                           $StagingFolder=RW:$GDriveSecure=RO \
                           $UnionFS
                   		sleep 2
                   	    if [[ -f "$UnionFS/GDriveSecureTest.txt" ]]; then
                              echo "$(date "+%d.%m.%Y %T") INFO: GDriveSecure Remount to UnionFS successful" | tee -a "/var/log/acd-check.log"
                           else
                              echo "$(date "+%d.%m.%Y %T") CRITICAL: GDriveSecure Remount to UnionFS failed." | tee -a "/var/log/acd-check.log"
                           fi
                           #This will restore any items that may have accidentally gotten trashed during the last mount failure.
                           sqlite3 $PMSAppData/Library/Application\ Support/Plex\ Media\ Server/Plug-in\ Support/Databases/com.plexapp.plugins.library.db "UPDATE metadata_items set deleted_at=null"
                      fi
                      fusermount -u $ACDSecure
                      fusermount -uz $ACDSecure
                      umount -l $ACDSecure
                      umount -f $ACDSecure
                      sleep 2
                      rclone mount \
                       	--allow-non-empty \
                       	--allow-other \
                   		--dir-cache-time 60m \
                       	--acd-templink-threshold 0 \
                       	--max-read-ahead 4G \
                       	--buffer-size 1G \
                       	--contimeout 15s \
                       	--low-level-retries 1 \
                       	--no-check-certificate \
                       	--quiet \
                       	--stats 0 \
                       	--retries 10 \
                       	--timeout 10s \
                   		--log-file=/mnt/user/appdata/PlexMediaServer/mount.log \
                   		ACDSecure:/ $ACDSecure &
                      sleep 2
                      if [[ -f "$ACDSecure/ACDSecureTest.txt" ]]; then
                         echo "$(date "+%d.%m.%Y %T") INFO: ACDSecure Remount successful" | tee -a "/var/log/acd-check.log"
                   	  	mkdir -p $UnionFS
                           sleep 2
                           unionfs \
                           -o cow,allow_other,direct_io,auto_cache,sync_read,nonempty,hide_meta_files \
                           $StagingFolder=RW:$ACDSecure=RO \
                           $UnionFS
                           #This will restore any items that may have accidentally gotten trashed during the last mount failure.
                           sqlite3 $PMSAppData/Library/Application\ Support/Plex\ Media\ Server/Plug-in\ Support/Databases/com.plexapp.plugins.library.db "UPDATE metadata_items set deleted_at=null"
                      else
                         echo "$(date "+%d.%m.%Y %T") CRITICAL: ACDSecure Remount failed." | tee -a "/var/log/acd-check.log"
                      fi
                   fi
					echo "The UnionFS Switch has been completed."
					#This moves the log file so that it the script does not keep looping
					mv $LOGFILE "$LOGFILE $(date)"
                fi
        done
1 Like

I dont get it whats the point of this script ?

I think he is trying to make a sort of raid-1 setup across two mounts (acd/gd). So if one fails, he mounts the other. I was actually going to try to play with ‘ChironFS’ which does this but im not sure if I want to start relying on abandonware.

This is as close as I can come to an analogy, correct.

It does become problematic, however.

Since rclone doesn’t support keeping original modification dates, they show up as different, causing Plex to think there are new things to be updated. I hadn’t thought of this beforehand. Now I’m thinking I’ll just be forced to make separate libraries for each.

hey just thinking out loud here, but if you can get this working properly, would it allow us to scan our drive under ACD, but play the files through GDrive?

If so, I love you <3

1 Like

Being that Plex detects changes and wants to do an update, if you have plex set to do anything automatic with regards to libraries, it will just get you the 24hr ban.

BUT, if you have all library management disabled, the files will play as long as they’re located in the same place.

In the current method, I wouldn’t recommend doing this, but it has worked for me in a pinch.

What I was hoping was to scan through ACD, which doesn’t do the 24 hr bans, but play through GDrive. I figure if plex doesn’t scan GDrive, GDrive wont get locked…

That is correct. But you have to be sure to turn off every automatic library update, or it will begin to scan your gdrive.

You could do a library update using ACD, then switch to gdrive to play the items after it completed. But then you’d have to do all library updates manually.

@xyber411
I thought so, but easier solution for above script is adding both drives in unionfs mount:

unionfs
-o cow,allow_other,direct_io,auto_cache,sync_read,nonempty,hide_meta_files
$StagingFolder=RW:$ACDSecure=RO:$GDriveSecure=RO
$UnionFS/

When ACD fails the plex will still see files on GDrive, its important to know whatever is first have priority eg if same file exist in all 3 mounts the file will be read first from Staging then ACD then GDrive.

Thats should not be the case
My main storage is ACD with crypt ( does not support change mod time ) then I make a copy to GDRIVE crypt and another copy to GDRIVE unencrypted ( that i have connected on Plex cloud )

As you can see bellow mod time is the same on all 3 drives so Plex wont see any difference as long as ACD is your main drive which keeps all mod times.

The only thing Iam really missing in rclone atm is the ability to copy/move files on more then one drive at the same time. Made feature request here few months ago

You can’t use unionfs like that. If you add both into unionfs and one fails, the mount fails. It doesn’t surpress the errors. It will show transport not connected at the top level.

This has been my experience as well. If the file does not exist on one drive, then that’s fine. The next drive is used. But if the file does exist, but fails to load for whatever cloud provider error, then the next drive is not used, but rather the first response in order is used. E.g.: staging is missing file a.mp4, it goes to ACD, which has a.mp4, but fails to start the stream. This response will be the response used. Gdrive will not be queried.

I wish it worked otherwise, and maybe there are some things that we don’t know about, but to my experience, this is accurate.

What I do is I point the first location in unionfs (after local cache) to a symbolic link which points to GDrive. I then monitor the rclone logs, and if I see any 403 errors indicating that the GDrive account is locked, I point the link to an empty directory instead, thus falling back to using ACD.

Also, I’m interested in how you did your file distribution to all 3 cloud drives. Currently, I have been using rclone copy from staging to ACD, then rclone copy from staging to gdrive, then a day or so later, an rclone move from staging to gdrive to clear out the file.

If I were to just do rclone copy from staging to ACD first, then do a sync from ACD to gdrive, would that keep the dates in tact?

The reason I haven’t been doing that in the past is because of the extremely long time it takes to begin a sync. It’s seriously like 2 hours of waiting before the first file begins transferring with a 35TB library.

What do you use to monitor those logs? Is it a simple grep script? Would you mind sharing a snippet?

Weird last time i was testing it my acdcrypt drive was just empty and in that case unionfs worked fine.

Iam moving from local directly to ACD crypt then i have another server running on online.net that is keeping the sync between drives

/usr/bin/rclone sync acduk:/crypt gdrive:/crypt -v --transfers=20 --checkers=20 --stats $STATS --log-file=$LOGFILE
/usr/bin/rclone sync gdrivecrypt:/movies gdrivecloud:/media/movies -v --transfers=$TRCH --checkers=$TRCH --stats $STATS --log-file=$LOGFILE
/usr/bin/rclone sync gdrivecrypt:/series gdrivecloud:/media/series -v --transfers=$TRCH --checkers=$TRCH --stats $STATS --log-file=$LOGFILE

Just a script constantly tailing the file looking for “403 Forbidden”.

#!/bin/bash
LOGFILE="/path/to/rclone-mount/logfile"

tail -fn0 $LOGFILE | \
        while read line ; do
                echo "$line" | grep "403 Forbidden" # Could probably be a bit more specific, does this always imply ban?
                if [ $? = 0 ] ; then
                        if [[ -z $(ls -l /mnt/plex/forced | grep empty) ]] ; then
                                ln -sfn /mnt/plex/empty/ /mnt/plex/forced
                                /bin/fusermount -uz /mnt/cloud/gd-sorted-crypt/
                                /usr/sbin/rclone mount --read-only --allow-other --stats 10s --buffer-size 2G -v --log-file=$LOGFILE gdrive-crypt:/ /mnt/cloud/gd-sorted-crypt/ &
                                /home/adam/bin/pushover.sh "GDrive monitor" "Blocked from GDrive, removed from mount." # alarm script
                        fi
                fi
        done

And then a cronjob that points the link back to GDrive at 16:00 every day:
0 16 * * * ln -sfn /mnt/cloud/gd-sorted-crypt/ /mnt/plex/forced

I read this at mergerfs readme. I wonder if this would hide the errors for us and let it work upon a failure:

Why use mergerfs over LVM/ZFS/BTRFS/RAID0 drive concatenation / striping?

With simple JBOD / drive concatenation / stripping / RAID0 a single drive failure will result in full pool failure. mergerfs performs a similar behavior without the possibility of catastrophic failure and difficulties in recovery. Drives may fail however all other data will continue to be accessable.

When combined with something like SnapRaid and/or an offsite backup solution you can have the flexibilty of JBOD without the single point of failure.

Yes, but if the file doesn’t exist, then it would not fail, but use the next drive. If the file exists, but fails to stream, then the stream failure is taken as a correct response, rather than using the next drive.

Seems to me that if I were to make use of this, I’d rewrite my original script to something like this:

Do not use this:

#!/bin/bash

#This script will monitor the mount's LogFile, and switch the ACDSecure drive and the GDriveSecure drive in the UnionFS Mount when there is a "403 Forbidden" error.
#
#Define your mount points & logfile here:
#
GDriveSecure="/mnt/disks/GDriveSecure"
ACDSecure="/mnt/disks/ACDSecure"
UnionFS="/mnt/disks/UnionFS"
StagingFolder="/mnt/user/Media/Staging"
LOGFILE="/mnt/user/appdata/PlexMediaServer/mount.log"

tail -fn0 $LOGFILE | \
        while read line ; do
                echo "$line" | grep "403 Forbidden" # Could probably be a bit more specific, does this always imply ban?
                if [ $? = 0 ] ; then
					#
					#Begin GDriveSecure Test, then switch to ACDSecure, and test.
					#
					if [[ -f $UnionFS/GDriveSecureTest.txt ]]; then
					   echo "$(date "+%d.%m.%Y %T") INFO: GDriveSecure mounted to UnionFS.  Remounting UnionFS to ACDSecure." | tee -a "/var/log/acd-check.log"
					   fusermount -u $UnionFS
					   fusermount -u -z $UnionFS
					   umount -f $UnionFS
					   umount -l $UnionFS
					   sleep 1
						mkdir -p $UnionFS
						   sleep 1
						   unionfs \
							   -o cow,allow_other,direct_io,auto_cache,sync_read,nonempty,hide_meta_files \
							   $StagingFolder=RW:$ACDSecure=RO \
							   $UnionFS
					   sleep 1
						  if [[ -f $UnionFS/ACDSecureTest.txt ]]; then
							 echo "$(date "+%d.%m.%Y %T") INFO: ACDSecure Remount successful" | tee -a "/var/log/acd-check.log"
						  else
							 echo "$(date "+%d.%m.%Y %T") CRITICAL: ACDSecure Remount failed." | tee -a "/var/log/acd-check.log"
						  fi
					else
					   echo "$(date "+%d.%m.%Y %T") GDriveSecure not currently mounted to UnionFS." | tee -a "/var/log/acd-check.log"
					   #
					   #Begin ACDSecure Test, then switch to GDriveSecure, and test.
					   #
					   if [[ -f $UnionFS/ACDSecureTest.txt ]]; then
						  echo "$(date "+%d.%m.%Y %T") INFO: ACDSecure mounted to UnionFS.  Remounting UnionFS to GDriveSecure." | tee -a "/var/log/acd-check.log"
						  fusermount -u $UnionFS
						  fusermount -u -z $UnionFS
						  umount -f $UnionFS
						  umount -l $UnionFS
						  sleep 1
							mkdir -p $UnionFS
							  sleep 1
							  unionfs \
								  -o cow,allow_other,direct_io,auto_cache,sync_read,nonempty,hide_meta_files \
								  $StagingFolder=RW:$GDriveSecure=RO \
								  $UnionFS
						  sleep 1
							 if [[ -f $UnionFS/GDriveSecureTest.txt ]]; then
								echo "$(date "+%d.%m.%Y %T") INFO: GDriveSecure Remount successful" | tee -a "/var/log/acd-check.log"
							 else
								echo "$(date "+%d.%m.%Y %T") CRITICAL: GDriveSecure Remount failed." | tee -a "/var/log/acd-check.log"
							 fi
					   else
						  echo "$(date "+%d.%m.%Y %T") ACDSecure not currently mounted to UnionFS." | tee -a "/var/log/acd-check.log"
					   fi
					fi
					echo "The UnionFS Switch has been completed."
                fi
        done