Saturday, July 25, 2015

How to synchronize files to cloud storage like google drive using rclone

Use rclone to copy local files or directory to google drive, google cloud storage, rackspace etc...


Main website:
http://rclone.org

How to Install and Use RClone with Google Drive

1. Download 'binary' to /usr/local/src
cd /usr/local/src
wget http://downloads.rclone.org/rclone-v1.17-linux-amd64.zip

2. Decompress zip
unzip rclone-v1.17-linux-amd64.zip

3. Copy rclone binary to /usr/local/bin (so that it can be executed from anywhere)
cd rclone-v1.17-linux-amd64
cp rclone /usr/local/bin/

4. Add configuration 'example-config'
rclone config

answer questions here ... this will setup a connection name and you will be required to authorize (get token) from google.

For google drive, when asked which type of storage, answer #6 'drive'.

5. Test it like this:

rclone --bwlimit=500k --log-file="/log/rclone/{{{backup_log_file.log}}}" sync {{{source_directory_to_sync}}} {{{rclone_connection_name}}}:{{{destination_directory_in_google_drive}}}

destination_directory_in_google_drive (without / prefix)
when asked about using your own certificate / key (answer just use rclone's)

for example:

(I am copying /databak/last_30_day directory from my server to google_drive_databak connection)
rclone --bwlimit=500k --log-file="/log/rclone/filename.log" sync /databak/last_30_day google_drive_databak:last_30_day

(I am copying /some_file.zip from my server to google_drive_databak connection's export directory)
rclone --bwlimit=500k --log-file="/log/rclone/filename.log" sync /some_file.zip google_drive_databak:export

No comments:

Post a Comment