Users will need this information when configuring access to OneDrive from a Linux Centos 8 VDI session.
Step-by-step guide
Configure
$ rclone config
- Select "n" for "New remote"
- Name your drive "OneDrive"
- Select the right code for OneDrive (which at the last time this document was updated was "28") for type of storage
Then follow the instructions. Default answers can be accepted safely for every question that has one.
When prompted, choose to use automatic config. This will open your browser and you will have to authenticate to receive a token.
After this, you will be asked to:
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>
Answer "1" (OneDrive Personal or Business).
All done. You can exit now.
$ mkdir ~/OneDrive ; chmod 755 ~/OneDrive
Mount
$ rclone mount --vfs-cache-mode full OneDrive: ~/OneDrive &
For more detailed information, please visit: https://rclone.org/commands/rclone_mount/
Unmount
$ fusermount -u ~/OneDrive
Refresh token
$ rclone config
Edit OneDrive, answer yes to the first question. Answer all defaults until rclone says that the token already exists, refresh? Say yes.
- The drive will stay mounted as long as the session is kept alive
- Even if the empty destination mount point is readable for group/all users, it won't be accessible by anyone but the user while it is mounted
- NEVER mount without the "--vfs-cache-mode full" command-line parameter to avoid risk of data corruption
Autostart
In order to get the mount added on login, you need to create a file named onedrive.desktop in ~/.config/autostart with the following lines:
[Desktop Entry] Name=Onedrive Type=Application Exec=sh -c "rclone mount --vfs-cache-mode full OneDrive: ~/OneDrive &"
Trusted files
23 Comments
Axel Bonet
https://rclone.org/onedrive/
excellent! thanks for this!
Steffen Tietsche
The warning that it currently does not work is outdated right? According to News Feed, should be working again since version 1.06?
Daniel Ali
You're right. Amending it now
Christopher Roberts
Will this functionality also be available on the new Atos HPC? I can see that rclone is installed on aa (> module spider rclone), but I cannot reproduce the configuration as described above for the VDI.
Daniel Ali
Hello Christopher Roberts
Yes, it works, confirmed. But it's easier if you create the configuration in VDI first, instead of the HPC. That is, treat the HPC as a headless machine so you don't have to use a graphical browser to connect to OneDrive for the first time (generate your token).
The problem is that currently our VDI is still running in Shinfield, so it has a different home, but it's easy to export the configuration and make it work exactly as in the VDI.
Let's suppose that you have created your configuration and got it working in the VDI with a folder under your home named "OneDrive"
From your VDI, do:
scp -pr .config/rclone aa:.config/rclone
Then log into aa:
ssh aa
mkdir OneDrive
module load rclone
rclone mount --vfs-cache-mode full OneDrive: ~/OneDrive &
Now your files should be accesible
Daniel Ali
Now I'm being told that rclone might NOT be available in the HPC in the upcoming future, so bear that in mind too
Christopher Roberts
Hi Daniel Ali , do you have any update on whether this functionality will be available on the Atos HPC? It would be extremely useful to have working as viewing plots/data on the Atos is extremely slow (either X11 forwarding or using VNC directly on Atos). The alternative is to copy data/plots between different machines, which easy access to Onedrive would simplify.
Daniel Ali
Confirmed that it WON'T be available in the Atos, but it WILL in the VDI service in Bologna, should that be of any help (hopefully, yes!) You can try the beta pointing your VDI client to desktop.ecmwf.int and let me know how it goes
Christopher Roberts
Thanks Daniel Ali. I have also tested the Bologna VDI and it is a much better experience (for me) than current options, so I am optimistic that we will have a good solution
Daniel Ali
Thanks for the positive feedback. There are some things to fix in the Bologna VDI still, but we're definitely getting there
Florian Pinault
I am not using VDI and from my laptop I am using ssh to connect. I installed rclone in locally (with "conda install rclone", and copied the config from my VDI) and the mount works as expect. I can access OneDrive from aa-login.
Tomas Kral
Just to give you a heads-up that in the latest version of rclone the type of storage "27" no longer refers to OneDrive. OneDrive is now choice "28". Might be better to update the instructions to use the name "onedrive" explicitly, when choosing the type of storage, rather than using the number.
Daniel Ali
Updated, thanks for the heads-up!
Daniel Ali
Thanks also to Kristian Mogensen who mentioned it as well
Luke Jones
Hi. I just tried this from a Bologna VDI but it fails after getting a token from the browser with the following error. Can anyone help?
Hans Hersbach
Looks like OneDrive now links to "32".
Didn't work though, but when I follow Tomas' tip type onedrive rather than a number it works!
It may be worthwhile to notice that you can also access your OneDrive via your browser.
You can do so after
1) logging in to outlook,
2) click the app Launcher (the grid icon left from the word Outlook at the top left and
3) click the cloud icon at the top left.
4) Voila, you're in!
That allows you to access your stuff without the need of having a link installed on your local computer.
Hans Hersbach
Is there anything special you need to do to keep your drive in sync on the Linux VDI?
Adrien Oyono Owono
Reply probably not needed anymore, but in case it's still relevant:
You don't need to do anything special (that is if waiting is not considered special
). I noticed that when you put some big files on your onedrive in one device (say, your EUD), you should allow for some minutes for it to appear on the other device (e.g: your Linux VDI). This is because onedrive first needs to upload the files from your mount point in your local device to its cloud, then download it in all other mount points you have. Then it all depends on your local internet upload speed and bandwidth load and the remote device internet download speed and bandwidth load.
Adrien Oyono Owono
Just in case someone bumps into the same issue:
I had a problem with rsync-ing between my onedrive mount and the local FS, and upon investigation, I found that I ran out of local disk space on the local device's /home, and that most of that disk space was occupied by rclone's cache.
The solution was to add the
--cache-dir
option to the mount command, and specify a directory somewhere with a lot of disk space (including an NFS mount):rclone
mount --cache-dir /some/path/with/lots/of/d.space --vfs-cache-mode full OneDrive: ~/OneDrive &
Otherwise, rclone uses the ~/home/.cache by default. If you have max 5G allocation on the /home partition and you put some 5G+ data on your mounted onedrive (which you might, given the 1T allocation there), you might run into problems.
Also, if you can't unmount with
fusermount -u ~/OneDrive
because the "device is busy", you can force unmount withfusermount -uz ~/OneDrive
Claudia Di Napoli
Hi Daniel Ali,
I am at the "Configure" stage.
After I type onedrive for Storage I am asked to choose a region. Is this correct?
Daniel Ali
Maybe it's a new question added in recent versions. When not sure, the default ("global", in this case) should work.
See in the document above:
"(...) Then follow the instructions. Default answers can be accepted safely for every question that has one. "
Claudia Di Napoli
Yes, the new version has a few other questions. I followed your advice on choosing the default answer and it worked.
Thank you!
Daniel Ali
Anytime, glad I could help!