Onedrive

mount to a folder

Rclone

You can use rclone to mount your UGent Ondrive to a folder. Make sure you have the rclone package, in the Terminal type:

sudo apt install -y rclone

check this URL: https://rclone.org/onedrive/. This is what you do:

$ rclone config
n -> New remote
myonedrive -> name
30 -> Microsoft OneDrive
ENTER -> client_id
ENTER -> client_secret
1 -> Microsoft Cloud Global
n -> Edit advanced config
y -> auto config
1 -> OneDrive Personal or Business
1 -> Documenten (business)
y -> okay?
y -> Yes this is OK
q -> Quit config

Test

Try to list your psychedelic directories:

rclone lsd myonedrive:

or recursively all files:

rclone ls myonedrive:

Mount

mkdir ~/onedrive
rclone --vfs-cache-mode writes mount myonedrive: ~/onedrive

The mount will be active until you interrupt it with ^C.

Now you can open your file browser and browse your ~/onedrive folder.

Speed

The speed is very good, I measured: read speed 28.8 MB/s, write speed: 47.4 MB/s !

Trash

If you delete files and folder, they will be transferred to the Onedrive Recycle bin, but you cannot see them in the mount. Goto this URL Recycle bin to empty your recycle bin. df -h shows the correct result! image At the bottom you will see a link Second-stage recycle bin which you can also empty. image

Sync

There is a way to sync between your local directory and the Onedrive, the example is with the Attachments directory:

mkdir Desktop/Attachments
rclone bisync  myonedrive:Attachments  Desktop/Attachments -P --resync

This is only needed the first time, then you can use the sync command:

rclone bisync  myonedrive:Attachments  Desktop/Attachments -P

You can put it in a loop e.g. every 60 sec:

while rclone bisync  myonedrive:Attachments  Desktop/Attachments -P;do sleep 60;done