5.1 Cloud storage
5.1.1 rclone: sync your files with cloud storage
Rclone is an general utility to manage files on cloud storage. It can with with over 40 cloud storage providers such as Dropbox, OneDrive, and so on.
Configuration
Before using
rclone
commands, you will need to configure it withrclone config
, and follow instructions. Below there is a simple example to configureOneDrive
:- execute
rclone config
from the terminal - write
n
to create a new remote configuration - write a custom name for the new remote (e.g.
remote
) - choose the type of storage (
onedrive
or26
) - press enter to use default
client_id
- press enter to use default
client_secret
- press enter to use default region (
global
). - write
n
to reject advanced configuration - write
y
to use auto configuration - write
1
to use OneDrive Personal or Business - select the drive available (usually
0
) - write
y
to confirm location details of drive - write
y
to confirm and finish configuration - write
q
to quit configuration
- execute
Mount approach
One approach to work with files located at cloud storage is to mount the remote drive as a file system on a mountpoint. Let consider that the remote has been configure with name
remote
, the syntax to mount this into the file system is:You can umount
/path/to/local/mount
withfusermount
commandBy default
rclone
will directly read and write directly the remote cloud storage, this might not be appropriate in case you are working with an slow internet connection. A useful alternative it to use cache options with--vfs-cache-mode
(off, minimal, writes, full). I tend to usewrites
orfull
options for a seamless editing:In case there is a warning about file permission at
~/.cache/rclone/vfs/remote
, modify the file permission withUnfortunately I have problems updating Office files (
.docx
,.xlsx
, and so on.)Sync/copy approach
In general this is a more reliable approach and with more control to define when to update the files. You can copy files from or to the remote cloud storage with
rclone copy
with the following syntax:Notice that
rclone
copies the contents of the directory as ifsourcepath
anddestpath
were written with a ending trailing/
.Folders can be synced with the following command:
Edited, removed or new files will be send to
destpath
. Be careful, because it can delete data. Option-i
can be used to make it interactive (asking for each file) as seen below.