Best mount settings for streaming ( Plex )

@MartinBowling

You’ll have to share what errors you’re getting. A couple problematic bugs with node-gdrive-fuse:

mod time is invalid for files, leads to Plex database corruption/dashboard breaking.

Writing the mount results in the same file appearing many times in the mount, doesn't play well with applications like Sonarr

No cache data cleanup of any kind...

https://github.com/thejinx0r/node-gdrive-fuse/pull/79/commits/3d755b9bfb704de4c5aebb97703a8d5ad964fa4b

Simply make the changes to the two files manually to fix the mod time problem.

For writing I use unionfs-fuse. This is a little tricky actually, because even though you can specify the local disk as the read/write priority, it won’t write to the local disk unless the folder it’s writing to exists already, or the less prioritized mount doesn’t have write enabled. I use automatic download handling software like Sonarr and I want it to be able to delete upgraded copies of my media.

Make local folder for temporary write:

/home/user/tmpwrite

Clone node-gdrive-folder structure:

cp -R --attributes-only /home/user/nodegdrivemount/MYMEDIA/Shows /home/user/tmpwrite/MYMEDIA/

cd /home/user/tmpwrite/MYMEDIA/Shows
find . -type f -size -1M -exec rm {} +
(Do this every once in a while)

Merge em together:

unionfs-fuse -o cow,allow_other /home/user/tmpwrite=RW:/home/user/nodegdrivemount=RW /home/user/unionfsmount

Move your temporarily written files to Google Drive at your leisure:

rclone --no-check-certificate --no-traverse --drive-chunk-size=64M --transfers=6 move /home/user/tmpwrite google:MYMEDIA/Shows --exclude .@**

Finally, the cache problem. I recommend setting the cacheLocation to /dev/shm/nodegdrivecache (your RAM).

Create bash script: cleanup.sh
find /dev/shm/gdrivecache/download -maxdepth 1 -mmin +1 -exec rm -f {} \;

Create a screen to run the script:

screen -S cleanup

Execute every 60 seconds:

watch -n 60 bash cleanup.sh

Adding new stuff to Google Drive is fine with node-gdrive-fuse but moving files around will result in you needing to rebuild the database, simply delete it from /dev/shm (or wherever) and start your mount again if needed.

1 Like