Using this mounts the remote OneDrive folder (or sub-folder) to a local mount point. This is
useful in that files from OneDrive are not taking up any local storage space, often useful for
laptop deployments. As files are opened, they are downloaded to a local temporary cache and later deleted
(from cache) when not accessed for some time
Ideally to use this feature you want Rclone v1.39 which supports
random read/write access to a locally mounted OneDrive folder. That means you can open and edit
non-simple files (such as Word documents) successfully. Older versions are limited to simple
text-based editors and/or copying files to and from OneDrive using drag/drop functionality in
your window manager
Mounting a folder
Before mounting your OneDrive folder, you need to create an empty directory to serve as a
mountpoint. For this example we will use the folder ~/OneDrive_test. Before continuing,
lets create this folder
  |
mkdir ~/OneDrive_test
|
In order to mount your entire OneDrive folder to ~/OneDrive_test, issue the command
(as a regular user):
  |
rclone mount OneDrive: ~/OneDrive_test
|
Note that the rclone program will not terminate until you unmount the folder. Alternatively,
killing the program will force an unmount. This is a good way to test your mounts prior to automating
the process
You may now copy files to and from the ~/OneDrive directory and its sub-directories. If you
login to OneDrive via a browser, you can see the files being added and removed from OneDrive
Mounting a sub-folder
For this example, we will create an alternate mountpoint to mount our OneDrive sub-folder. Lets
call this directory ~/OneDrive_subfoldertest
  |
mkdir ~/OneDrive_subfoldertest
|
Consider a sub-folder in your OneDrive account called I4T. In order to mount
this sub-folder ~/OneDrive_subfoldertest, issue the command
(as a regular user):
  |
rclone mount OneDrive:I4T ~/OneDrive_subfoldertest
|
You can also specify deeper folder names on OneDrive and to the local mountpoint. As for mounting
the entire OneDrive folder, the rclone program will not terminate until you unmount the
folder, killing rclone will force an unmount
Parameters to rclone
To maximise performance, you might want to use the following command line parameters when mounting a
OneDrive (sub-)folder:
--no-modtime |
Will maximise network performance by not modifying times on OneDrive. The current API will
result in backup copies being made on every edit/save if you do not use this option |
--vfs-cache-mode full |
Only functions on v1.39 or higher of Rclone. If used, will
allow random read/write access to the mounted drive, allowing you to edit files live to the
OneDrive folder |
For further parameters which might be useful, see the rclone
online documentation
Automating mounts
As the rclone mount command is run as a regular user rather than as root, you cannot
apply the usual techniques to automatically mount your OneDrive folders. Below is a simple technique
that works in the KDE environment, if you are using a different Window Manager, there will be a similar
option available
- Create the following file as ~/bin/rclone_mount.sh
  |
#!/bin/bash
RCLONE=`which rclone`
RCLONE_PARAMS="--no-modtime"
### Use this RCLONE_PARAMS for rclone >=v1.39
#RCLONE_PARAMS="--vfs-cache-mode full --no-modtime"
${RCLONE} mount ${RLCONE_PARAMS} OneDrive: ~/OneDrive &
|
- Change permissions on the script to make it executable
  |
chmod +x ~/bin/rclone_mount.sh
|
- Within KDE System Settings --> Startup and Shutdown --> Autostart
- Click Add Script...
- Browse for your new script and select it
- Click OK
The script will run (and mount your OneDrive folder upon login
If you wish to add more mount-points for OneDrive sub-folders, add extra ${RCLONE}
lines to the script above
|