Use rclone on google colab

I'm new to google colab and rclone, and I can't seem to find any tutorial on how to clone rclone into google colab and start using rclone with command !rclone.
I tried to clone it with command: ! git clone
and it said all done, but then when I type !rclone it returns: /bin/bash: rclone: command not found

Can you please help me on how to use rclone on my google colab? thanks.

1 Like

Check out:

I've often used rclone on Colab because the default drive connector has a timeout problem.

Create a new code cell, paste the installation command and execute it.

! curl | sudo bash

Read the documentation to understand rclone - how the config system works, etc.

If you have an existing rclone config, you can write the config file directly into a cell:

!mkdir /root/.config/rclone/
config = """
with open('/root/.config/rclone/rclone.conf', 'w') as file:

Afterwards, you can call rclone like any other native command:

!rclone copy a b

A few things from experience:

  • Keep an eye on the traffic - I've heard from people that had their account banned for excessive colab usage. Personally, I have only received temporary GPU bans though, so who knows.
  • If you want persistence, do not use rclone mount - instead, schedule repeated runs of rclone copy, usually with much better performance.
  • Colab resets and recycles your docker instance when not in use (or >12h). If you save your file system at the end of your notebook, you can restore it in the beginning of your notebook the next time you use it.

Thank you so much, it worked.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.