Google Drive - One Drive - DropBox - etc using RCLONE

Moderator: Forum moderators

Post Reply
User avatar
p310don
Posts: 356
Joined: Tue Dec 03, 2019 7:17 am
Location: Brisbane, Australia
Has thanked: 72 times
Been thanked: 103 times

Google Drive - One Drive - DropBox - etc using RCLONE

Post by p310don »

Rclone is a tool to connect and manipulate your remote drives from the command line. It can also be used to create "local" drives that are actually remote drive. This is much the same as gdrive & onedrive on Windows.

This is how I have mine set up...

First things first, get rclone. I use fatdog, it is available in gslapt. You can simply download it from www.rclone.org and extract the rclone executable. It will run on it's own, or you can put it in /usr/lib so that it runs from anywhere.

Open a terminal and run

Code: Select all

rclone config

Code: Select all

n
for New remote

Code: Select all

give it a name you would like to use, eg gdrive
Next it asks what type of remote you are making. Use the word in inverted commas, not the number. For google drive it is "drive"

Code: Select all

drive
I recommend just using the default for the next 2 questions. Hit

Code: Select all

enter
twice

The next question is scope, I pressed 1 for full access. You can do what you like.

Enter 2 more times

Edit advanced config?

Code: Select all

n
Use Auto Config?

Code: Select all

y
This will open your browser to a google sign on page. You will need to sign in (if not already) and allow rclone to access your google drive. It will come up with a success page (hopefully!)

Back to terminal. It will ask if this is to be set up as a team drive. Probably not, so

Code: Select all

n
It then asks is all is ok, type

Code: Select all

y
and then you're back to the beginning. If you're done setting up drives, type

Code: Select all

q
to quit config.

I created a folder called "cloud" and then a subfolder for gdrive, onedrive & dropbox respectively (you can create a folder for whatever remote drive you have). Furthermore, you can create subfolders to have multiple accounts in each drive. I have a personal and work google drive, so the path to mine has /root/gdrive/work & /root/gdrive/personal These folders will be used as mount points.

To mount your drive you can use a couple of options. The fastest seems to be

Code: Select all

rclone mount gdrive: ~/cloud/gdrive
This will mount your remote you just created called "gdrive" at the /root/gdrive folder. The folder must be empty for this to work.

Alternatively, you can use this code. I use this one so I can edit libreoffice documents. It allows LO to create a temp file whilst editing your documents.

Code: Select all

rclone --vfs-cache-mode writes mount "gdrive": ~/cloud/gdrive
For fun, you can add these to your startup folder so that it automatically mounts when you start. I created a bash script with a 20 second delay and put it in ~/startup The delay is to ensure that the internet is connected before it tries to mount, otherwise it doesn't work. The script is simply:

Code: Select all

#!/bin/sh
sleep 20
rclone --vfs-cache-mode writes mount "gdrive": ~/cloud/gdrive
I can now copy and paste files to and from my google drive. For small stuff, it works almost seamlessly. For big files, obviously it takes time to copy, and if you have a lot of files in the directory, it takes time to load them all in ROX. And of course, the time depends on your connection speed. This would be no fun on dialup!!

Of course you can set up your own locations, names and mount points to suit yourself, but the process as above works for me.

You can repeat the same process for OneDrive, DropBox and any of the multitude of other remotes it supports. For more info on rclone, see here:

http://www.rclone.org
Last edited by p310don on Mon Aug 31, 2020 12:15 pm, edited 1 time in total.
User avatar
mikewalsh
Moderator
Posts: 6150
Joined: Tue Dec 03, 2019 1:40 pm
Location: King's Lynn, UK
Has thanked: 788 times
Been thanked: 1976 times

Re: Google Drive - One Drive - DropBox - etc using RCLONE

Post by mikewalsh »

Interesting.

I was playing around with this, night before last. For some reason, I cannot get Google to authorize the Drive to work with this; every time, it errors-out with a 404: Not found.....

Fred's GDrive GUI two-paner, on the other hand, works flawlessly. Bit of a no-brainer, really..! :D


Mike. ;)
User avatar
p310don
Posts: 356
Joined: Tue Dec 03, 2019 7:17 am
Location: Brisbane, Australia
Has thanked: 72 times
Been thanked: 103 times

Re: Google Drive - One Drive - DropBox - etc using RCLONE

Post by p310don »

I was using Fred's GDrive gui. It is good, but the method I'm using now (as described above) is simply integrated as another drive, rather than a separate application.

I don't know why you cannot get authorisation from google drive with rclone, it is pretty much the same as the process for Fred's version. If you got one to work, in theory you should be able to get the other running.
User avatar
wiak
Posts: 4079
Joined: Tue Dec 03, 2019 6:10 am
Location: Packing - big job
Has thanked: 65 times
Been thanked: 1206 times
Contact:

Re: Google Drive - One Drive - DropBox - etc using RCLONE

Post by wiak »

p310don wrote: Tue Aug 25, 2020 11:40 pm Rclone is a tool to connect and manipulate your remote drives from the command line. It can also be used to create "local" drives that are actually remote drive. This is much the same as gdrive & onedrive on Windows.

This is how I have mine set up...
Nice post. Yes, I also used rclone previously, and have also usefully used fredx181 dual panel app, which was great. However, I also personally prefer just using rclone in method like yourself since once set up it all becomes pretty seamless, as you say, and no need to run gtkdialog process/app to upload/download anything. Been a while since I've used either but about to set up rclone again, and thanks for reminding me.

wiak

https://www.tinylinux.info/
DOWNLOAD wd_multi for hundreds of 'distros' at your fingertips: viewtopic.php?p=99154#p99154
Αξίζει να μεταφραστεί;

User avatar
Indy
Posts: 3
Joined: Tue Jul 14, 2020 3:46 pm
Has thanked: 4 times

Re: Google Drive - One Drive - DropBox - etc using RCLONE

Post by Indy »

Thanks for this, p310don. I followed your instructions and it's working for me. Good stuff; very handy!

(By the way, there's an extra "s" with the reference to "~/cloud/gdrives" somewhere in there but I didn't even notice it until after I'd already succesfully set it up. :) )
User avatar
p310don
Posts: 356
Joined: Tue Dec 03, 2019 7:17 am
Location: Brisbane, Australia
Has thanked: 72 times
Been thanked: 103 times

Re: Google Drive - One Drive - DropBox - etc using RCLONE

Post by p310don »

By the way, there's an extra "s" with the reference to "~/cloud/gdrives"
Not any more!! Thanks for pointing that out. Fixed now.

I'm glad it worked for you Indy. Are you using Fatdog, or another Pup?
User avatar
Indy
Posts: 3
Joined: Tue Jul 14, 2020 3:46 pm
Has thanked: 4 times

Re: Google Drive - One Drive - DropBox - etc using RCLONE

Post by Indy »

I have it running on Xenialpup32, actually. Still kicking!
User avatar
Indy
Posts: 3
Joined: Tue Jul 14, 2020 3:46 pm
Has thanked: 4 times

Re: Google Drive - One Drive - DropBox - etc using RCLONE

Post by Indy »

I noticed that my auto-mounting of my GDrive at startup via rclone was failing. It was coming up with this error:

"Fatal error: Directory is not empty:" along with "If you want to mount it anyway use: --allow-non-empty option"

So, I added it at the end and it started to work again. My rclone line now looks something like this:

rclone --vfs-cache-mode writes mount "gdrive": ~/cloud/gdrive --allow-non-empty option

Hope it helps.

User avatar
wizard
Posts: 1973
Joined: Sun Aug 09, 2020 7:50 pm
Has thanked: 2634 times
Been thanked: 684 times

Re: Google Drive - One Drive - DropBox - etc using RCLONE

Post by wizard »

Rclone is very powerful and useful. Have not tried the "local drive" feature, but is used every day for remote backup/sync of critical files (automatic with a scheduler).

Thanks @p310don
wizard

Big pile of OLD computers

Post Reply

Return to “File Management”