Install & Setup rclone (Ubuntu/Debian)

1. To install rclone type the following into your SSH terminal(PuTTY):

curl https://rclone.org/install.sh | sudo bash

2. Now we will make sure fusefs can use the –allow-other flag by typing the following:

sudo nano /etc/fuse.conf

3. Once you have the fuse.conf file open make sure you remove the # before the word user_allow_other once you have done this press Ctrl+x then press y to save. Your file should look similar to the image below:

rclone Remote Setup

Now we will setup the rclone remote, a “remote” is the connection settings for a cloud storage drive.
Step 1: Type: rclone config
Step 2: Type: n Press: Enter
Step 3: Type: plexcloudservers Press: Enter
Step 4: Type: drive Press: Enter
Step 5: Paste you client_id and client_secret which you can create by following this guide: How to: Google Drive API Client ID and Client Secret
(To paste in PuTTY simply right click, to copy in PuTTY simply highlight the text. Do not press Ctrl+C or Ctrl+V)
Step 6: Type: drive Press: Enter
Step 7: Press: Enter
Step 8: Press: Enter
Step 9: Type: n Press: Enter
Step 10: Type: n Press: Enter
Step 11: Highlight the link with your mouse (Do not press Ctrl+C if you are using PuTTY, highlighting the text with your mouse will copy it.) and then paste the link into a browser window, login with your Google account and press Allow. It will give you a code copy that code and paste it back into the PuTTY window using right click. Press: Enter
Step 12: Type: y Press: Enter
Step 13: Look in the list for the Team Drive called “PlexCloudServers” type the number next to this Team Drive. If this is the only Team Drive in your account it will be the number 1 so Type: 1 Press: Enter
Step 14: Type: y Press: Enter
Step 15: Type: q Press: Enter
You have now setup an rclone remote which links to the Google Team Drive, the remote name is plexcloudservers. Next we need to mount this remote. You have a couple of options depending on your server. If you have root access you can use systemd and create a daemon service to mount it. If you are using a none root seedbox you can use screen to mount it in the background.

Mounting the Team Drive with screen

1.  First we need to make a folder in your mnt directory to mount the Team Drive in. Lets call it plexcloudservers. To do this type:

sudo mkdir ~/plexcloudservers

2. To create a screen instance called mount we will type the following into the terminal:

screen -S mount

3. Now it is time to mount the Google Team Drive by pasting the follow mount command into the terminal window:

rclone mount plexcloudservers:/Media ~/plexcloudservers --rc --rc-no-auth --rc-addr=localhost:5573 --drive-skip-gdocs --vfs-read-chunk-size=64M --vfs-read-chunk-size-limit=2048M --buffer-size=64M --poll-interval=15s --dir-cache-time=1000h --timeout=10m --drive-chunk-size=64M --drive-pacer-min-sleep=10ms --drive-pacer-burst=1000

4. Now you can de-attach from the screen instance by pressing and holding Ctrl+A, then the letter D.

5. You can now run the following command to pre-build the cache if you want to have a faster mount you only need to do this once after a remount/reboot.

rclone rc vfs/refresh recursive=true --rc-addr localhost:5573 _async=true

You can now check to see if the media files are mounted by typing: /mnt/plexcloudservers and then typing ls if you see Movies and TV folders it looks like everything is mounted correctly.

Systemd Service

If you have root access you can create service to run on startup so your Shared Drive mount runs in the background and automatically re-mounts on reboot.

1.  First we need to make a folder in your mnt directory to mount the Shared Drive in. Lets call it plexcloudservers and the setup the correct permissions To do this type:

sudo mkdir /mnt/plexcloudservers
sudo chmod 775 /mnt/plexcloudservers

2. First we need to create the plexcloudservers.service file by typing the following:

sudo nano /etc/systemd/system/plexcloudservers.service

3. Now edit and paste the following text into your terminal window by right clicking. Remember to replace the word chudz in the text below with your own user.

[Unit]
Description=Rclone VFS Mount
After=network-online.target

[Service]
User=chudz
Group=chudz
Type=notify
ExecStartPre=/bin/sleep 10
ExecStart=/usr/bin/rclone mount \
  --user-agent='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.131 Safari/537.36' \
  --config=/home/chudz/.config/rclone/rclone.conf \
  --allow-other \
  --allow-non-empty \
  --rc \
  --rc-no-auth \
  --rc-addr=localhost:5573 \
  --drive-skip-gdocs \
  --vfs-read-chunk-size=64M \
  --vfs-read-chunk-size-limit=2048M \
  --buffer-size=64M \
  --poll-interval=15s \
  --dir-cache-time=1000h \
  --timeout=10m \
  --drive-chunk-size=64M \
  --drive-pacer-min-sleep=10ms \
  --drive-pacer-burst=1000 \
  --umask=002 \
  --syslog \
  -v \
  plexcloudservers: /mnt/plexcloudservers
ExecStartPost=/usr/bin/rclone rc vfs/refresh recursive=true --rc-addr localhost:5573 _async=true
ExecStop=/bin/fusermount -uz /mnt/plexcloudservers
Restart=on-abort
RestartSec=5
StartLimitInterval=60s
StartLimitBurst=3

[Install]
WantedBy=default.target

4. Now press Ctrl+X and then press y to save the file.

5. Now lets enable and start the daemon, by typing the following 1 line at a time:

sudo systemctl enable plexcloudservers.service
sudo systemctl start plexcloudservers.service

Check to see if the service is running by typing: (Make sure its green and says active (running)

systemctl status plexcloudservers

You can now check to see if the media files are mounted by typing: cd /mnt/plexcloudservers and then typing ls if you see Movies and TV folders it looks like everything is mounted correctly.

6. We can now setup a 2 more services that will refresh the cache once a day.

sudo nano /etc/systemd/system/plexcloudservers_refresh.service

7. Paste the following in like before and replace the username chudz with your own linux username.

[Unit]
Description=Rclone VFS Refresh - Service
Requires=plexcloudservers.service
After=plexcloudservers.service

[Service]
User=chudz
Group=chudz
Type=oneshot
ExecStartPre=/bin/sleep 10
ExecStart=/usr/bin/rclone rc vfs/refresh recursive=true --rc-addr localhost:5573 _async=true

[Install]
WantedBy=default.target

8. Now we enable and start the service:

sudo systemctl enable plexcloudservers_refresh.service
sudo systemctl start plexcloudservers_refresh.service

9. Now we need to setup one last file:

sudo nano /etc/systemd/system/plexcloudservers_refresh.timer

10. Paste the following in like before.

[Unit]
Description=Rclone VFS Refresh - Timer

[Timer]
OnUnitInactiveSec=86400

[Install]
WantedBy=timers.target

11. Now we enable and start the service:

sudo systemctl enable plexcloudservers_refresh.timer
sudo systemctl start plexcloudservers_refresh.timer
Scroll to Top