Table of Contents

Using One Drive on Linux

Setup One Drive

# rclone config
No remotes found - make a new one
n) New remote
s) Set configuration password
q) Quit config
n/s/q>  n
name> UL-OneDrive 
Type of storage to configure.
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value
...
21 / Mega
   \ "mega"
22 / Microsoft Azure Blob Storage
   \ "azureblob"
23 / Microsoft OneDrive
   \ "onedrive"
24 / OpenDrive
   \ "opendrive"
25 / Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
   \ "swift"
...
Storage> onedrive
** See help for onedrive backend at: https://rclone.org/onedrive/ **
Microsoft App Client Id 
Leave blank normally.
Enter a string value. Press Enter for the default ("").
client_id> 
Microsoft App Client Secret
Leave blank normally.
Enter a string value. Press Enter for the default ("").
client_secret> 
Edit advanced config? (y/n)
y) Yes
n) No (default)
y/n> n
Remote config
Use auto config?
 * Say Y if not sure
 * Say N if you are working on a remote or headless machine
y) Yes (default)
n) No
y/n> y
Choose a number from below, or type in an existing value
 1 / OneDrive Personal or Business
   \ "onedrive"
 2 / Root Sharepoint site
   \ "sharepoint"
 3 / Type in driveID
   \ "driveid"
 4 / Type in SiteID
   \ "siteid"
 5 / Search a Sharepoint site
   \ "search"
Your choice> 1
Found 1 drives, please select the one you want to use:
0: OneDrive (business) id=b!9lLca7qW5Uqos5tnc3zl3xVQs7GKhd1Pi_6ugA5eVjVYitM-xxxxxxxxxxxxxx
Chose drive to use:> 0
Found drive 'root' of type 'business', URL: https://leidenuniv1-my.sharepoint.com/personal./deuler_vuw_leidenuniv_nl/Documents
Is that okay?
y) Yes (default)
n) No
y/n> y
--------------------
[UL-OneDrive]
type = onedrive
token = {"access_token":"xxx...xxx"}
drive_id = b!9lLca7qW5Uqos5tnc3zl3xVQs7GKhd1Pi_6ugA5eVjVYitM-xxxxxxxxxxxxx
drive_type = business
--------------------
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d> y
Current remotes:

Name                 Type
====                 ====
UL-OneDrive          onedrive  

e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q> q
mkdir ~/OneDrive

Mount One Drive

Mount the remote onedrive by using the command:

rclone --vfs-cache-mode writes mount UL-OneDrive: ~/OneDrive &

And now the drive is mounted:

# df ~/OneDrive  
Filesystem      1K-blocks  Used  Available Use% Mounted on
UL-OneDrive:   1073741824  2952 1073738868   1% /home/deul/OneDrive

Unmount One Drive

To unmount the onedrive mount point we must use the fusermount command:

fusermount -u /home/deul/OneDrive

Now check if the mount point is still used or cascades down to the home drive:

df ~/OneDrive
Filesystem               1K-blocks       Used  Available Use% Mounted on
homeserver:/export/home 6390518784 4040379904 2028000256  67% /home

Indeed onedrive is not mounted on this mountpoint any more