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:

Type of storage
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.

Create your OneDrive folder and ensure it's readable
$ mkdir ~/OneDrive ; chmod 755 ~/OneDrive

Mount

Always mount using "full" VFS cache mode
$ rclone mount --vfs-cache-mode full OneDrive: ~/OneDrive &

For more detailed information, please visit: https://rclone.org/commands/rclone_mount/

Unmount

Unmount using fusermount
$ fusermount -u ~/OneDrive

Refresh token

Refresh token if it no longer works
$ 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:

~/.config/autostart/onedrive.desktop
[Desktop Entry]
Name=Onedrive
Type=Application
Exec=sh -c "rclone mount --vfs-cache-mode full OneDrive: ~/OneDrive &"

Trusted files

You might need to allow onedrive.desktop to be trusted in order to make it work. Just open the file browser, navigate to the file and double click on it. On the dialog select "Trust and Launch"





23 Comments

  1. The warning that it currently does not work is outdated right? According to News Feed, should be working again since version 1.06?

    1. You're right. Amending it now

  2. 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. 

    1. 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 (smile)

    2. Now I'm being told that rclone might NOT be available in the HPC in the upcoming future, so bear that in mind too

      1. 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. 

        1. 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

          1. 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 (smile)

            1. Thanks for the positive feedback. There are some things to fix in the Bologna VDI still, but we're definitely getting there

          2. 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.

  3. 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.

    1. Updated, thanks for the heads-up!

      1. Thanks also to Kristian Mogensen who mentioned it as well

  4. 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?

    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> 
    2022/08/30 17:38:43 NOTICE: If your browser doesn't open automatically go to the following link: http://127.0.0.1:53682/auth?state=z04mVuFuCJxV6tVaqm45yg
    2022/08/30 17:38:43 NOTICE: Log in and authorize rclone for access
    2022/08/30 17:38:43 NOTICE: Waiting for code...
    2022/08/30 17:38:45 NOTICE: Got code
    Error: failed to get token: Post "https://login.microsoftonline.com/common/oauth2/v2.0/token": proxyconnect tcp: dial tcp 136.156.66.108:3333: i/o timeout



  5. 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.

  6. Is there anything special you need to do to keep your drive in sync on the Linux VDI?

    1. 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 (big grin)). 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.

  7. 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 with fusermount -uz ~/OneDrive 

  8. 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?

    1. 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. "

      1. Yes, the new version has a few other questions. I followed your advice on choosing the default answer and it worked. (smile) Thank you!

        1. Anytime, glad I could help!