Cloud Service Center

DYI OneDrive for Business / Sharepoint Backup

In a previous article we learned that files are very safely stored, now I’,m showing you how to do a backup, isn’t there a contradition here ? Well, maybe you have other  good reasons why you want to backup the files. For example, you might be concerned that someone with access to your sharepoint might delete files and then remove them from the Bin.

 

 

In my case, I want to be protected from every Black Swan event. I know that I have a backup even if I have an accident and go into coma for a year and Microsoft closes my account, when I wake up I will have access to my files. 

 

 

Or, you might actually want to backup a device like a Raspberry on OneDrive/Sharepoint, this method will work as well. So, here is an example on how to backup OneDrive to a folder in you computer and this will work for Windows, MacOs and Linux. Please note this example works for a OneDrive for Business, which is a private Sharepoint, you will need minor changes for a common SharePoint site.

 

 

  1. Download rclone from https://rclone.org and install it
  2. Add Rlone to myapplications.microsoft.com
  3. Configure rclone, in this example I’ll be synching my OneDrive folder to a drive on a Windows system. 
 

 

 

On a command line follow these steps:

 

 

 

rclone config

(Selected options are in bold)

 

No remotes found, make a new one?

n) New remote

s) Set configuration password

q) Quit config

 

name> OneDriveAires ETH

27 / Microsoft Azure Blob Storage

   \ (azureblob)

28 / Microsoft OneDrive

   \ (onedrive)

29 / OpenDrive

   \ (opendrive)

 

 

Storage> onedrive

 

client_id>  — leave bank —

client_secret>  — leave it blank —

 

Press Enter for the default (global).

 1 / Microsoft Cloud Global

   \ (global)

 2 / Microsoft Cloud for US Government

   \ (us)

 3 / Microsoft Cloud Germany

   \ (de)

 4 / Azure and Office 365 operated by 21Vianet in China

   \ (cn)

region> 1

 

 

Edit advanced config?

y) Yes

n) No (default)

y/n> n

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

 

Then a browser will start. Please log-in. On a remote or headless machine an alternative log-in method would be provided.

 

Press Enter for the default (onedrive).

 1 / OneDrive Personal or Business

   \ (onedrive)

 2 / Root Sharepoint site

   \ (sharepoint)

   / Sharepoint site name or URL

 3 | E.g. mysite or https://contoso.sharepoint.com/sites/mysite

   \ (url)

 4 / Search for a Sharepoint site

   \ (search)

 5 / Type in driveID (advanced)

   \ (driveid)

 6 / Type in SiteID (advanced)

   \ (siteid)

   / Sharepoint server-relative path (advanced)

 7 | E.g. /teams/hr

   \ (path)

config_type> 1

 

Drive OK?

 

Found drive “root” of type “business”

URL: https://ethz-my.sharepoint.com/personal/[yournamehere]_ethz_ch/Documents

 

y) Yes (default)

n) No

y/n> y

 

 

[OneDriveAiresETH]

type = onedrive

token = {“access_token”:”eyJ0mysecrettokenwhichIwouldneverpublishonline”,”expiry”:”2022-06-17T18:00:22.9325477+02:00″}

drive_id = andiwouldalsoneverpublishthedriveidonlinejustincase

drive_type = business

——————–

y) Yes this is OK (default)

e) Edit this remote

d) Delete this remote

y/e/d> y

 

Name                 Type

====                 ====

OneDriveAiresETH     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

 

 

Then create a folder where you will sync the files, for example OneDriveCopy:

mkdir OneDriveCopy

cd OneDriveCopy

 

CdC:\dev\rclone\OneDriveCopy

 

 

sync -v OneDriveAiresETH:/ C:\dev\rclone\OneDriveCopy

 

 

 

 

Now look at what you just did. Your drive is being copied from OneDrive to you folder OneDriveCopy.

 

 

 

 

If you want to run this regularly, on Linux or MacOs you can add this script to the crontab. On Windows you can use the Task Scheduler.  There is plenty of sites describing this, for the sake of enthropy I will not describe it again here. You could also use this to synchronize Google Drive or any other drive to  OneDrive/Sharepoint.

 

Microsoft OneDrive Settings Account Backup Newvork Office About Z] Start OneDrive automabcally when I sign in to Windows [3 Automabcally pause sync when this device is in battery saver mode Z] Automatcally pause sync when this device is on a metered neb,Nork Not fica bons Z] Before many files that I deleted on my PC are removed from the cloud Z] When sync pauses automa bcally Files On -Demand Save space and download files as you use them More info Microsoft OneDrive Disable Files On-Demand All OneDrive files and folders will download to this PC. Cancel

 

 

Last, another simple option is simply to keep all the OneDrive files in your computer, in order to do that, go the OneDrive settings and Disable On-Demand.  You could also use an old computer with a large enough harddrive to do this and use it as a kind of backup server, just remember that if in this case files are deleted in the cloud they will also be deleted from the computer if it is connected to the Internet.

 

 

And there you go. Now we know that our files are safer than any of us will ever be.