Use rclone to Perform a One-Way Sync from OneDrive to Your Home Directory

SSD Home directories are located on a storage unit named harbor.uchicago.edu.  On Acropolis, Cronus, and Athens, Home directories are mapped out to /home/<your_cnet_id> in the Linux computing environment.  In SSDLAB, these are mapped out to the H: drive.  This article demonstrates a method for copying or synchronizing files from OneDrive to your Home directory, and vice versa.

Note: The rclone command does not function in the same way as the OneDrive client application.  rclone is a one-way sync and is destructive to the target.  It also needs to be launched manually each time you wish to sync your files.  For example, if I have made updates recently to the files in my Home directory, syncing from the cloud to my Home directory will wipe out any changes I have made to my Home drive.  Use this tool with caution, and do not attempt to set up rclone as a cron job.

Use this strategy responsibly.  Your data may be subject to a DUA or IRB guidelines, and several University of Chicago policies may be applicable.  Please see the site for our Divisional Security Officer for resources, answers to frequently asked questions, and contact info for any additional questions.

 

Configure rclone for OneDrive

To start out, you need a graphical interface.  You’ll need to use EasyVNC to get connected to one of the computing environments (e.g. Cronus, Athens, or Acropolis).  

 

Launch a terminal inside your VNC session.

Screenshot

 

Inside the Terminal session, create a folder for OneDrive in your Home directory and launch the rclone config.  Select ‘n’ for New Remote.  Enter ‘OneDrive’ as the name of the remote.

Screenshot

 

Select option ’26’ for OneDrive. 

  • Press the Enter key to accept defaults for the OAuth Client Id and the OAuth Client Secret (the first two prompts). 
  • At the prompt for region, select option 1 for Microsoft Cloud Global.
  • Press the Enter key to accept the default of No for ‘Edit Advanced Config’
  • Type y to use Auto Config

 

At this point, the web browser should open to the correct page automatically.  You might be prompted to select a browser. 

 

If prompted, authenticate for access to your OneDrive.  Afterwards, you should see confirmation of successful authentication in your browser.

 

Go back to your terminal window and choose option 1 for ‘OneDrive Personal or Business’

 

rclone should detect one drive.  It will be numbered ‘0’.  Type 0 and press enter.  Then type y and press enter again.

 

Type y and press enter one more time.

 

Enter ‘q’ to quit config. 

 

Sync a Folder from OneDrive to your Home Directory

Use this with caution.  The synchronization is destructive.  This means that anything in anything different in your Home directory will be overwritten from files in OneDrive.  Also, any new files that are present in Home directory but not in OneDrive will get deleted.

In this example, I will choose one subfolder in OneDrive that I wish to sync to my home directory on Acropolis.  If you haven’t done so already, make a directory for OneDrive inside /home/<username/OneDrive.

 

Run rclone sync with the appropriate parameters and then test to make sure your files appear in the target directory.  In this example I am replicating the OneDrive folder named ‘Screenshots” into my Home directory:

rclone sync ‘OneDrive:/Screenshots/’ ~/OneDrive/ 

 

Sync a Folder back to Cloud Storage

OneDrive presents challenges which make it much less desirable than Box.  Rclone definitely supports OneDrive and replicating files into OneDrive from your Home directory is relatively simple if you have already gone through the above setup.  However, Box cloud storage is strongly preferred vs. OneDrive for security, usability, capacity, and to avoid some challenges with vendor lock-in to the Microsoft ecosystem that may inconvenience you in the future.  Our support for sync to OneDrive is on a best-effort basis.  You can reasonably expect problems going the OneDrive route.

Please see the FAQ page for Box: Use rclone for One-Way Sync between Box and your Home Directory | Social Sciences Computing Services (uchicago.edu)

 

Summary

To summarize: rclone sync ‘source/’ ‘target/’.  Pay close attention to the / (forward slash) at the end of the directory name as well as the ‘ (single quotation mark); without this syntax the command will not produce the expected results.

Reference Documentation (rclone.org) for more information about rclone usage.