How to save Apple Time Machine backups to cloud services like OneDrive

01/12/2018 19:28 By Lhyam
Time Machine is an awesome feature, and in my opinion, is the best feature of macOS. Yes, Windows has File History, but even as a diehard Windows fan (its my natural computing home), it's nowhere near as comprehensive as Time Machine. You can literally restore a Mac and pick up exactly where you left off previously, without having to re-install your applications, setting up preferences or faffing around with drivers!

However, it relies on you having an external hard disk drive plugged in in order for it to back up. Surely, in 2018, there must be a way to backup to cloud services? I have a whole 1 TB of space just sitting there with my Microsoft Office 365 subscription that could be put to better use. Whilst, I already have my Documents, Pictures, Music, Videos and even my Desktop folder, backed up to OneDrive and redirected on my Mac, what about my applications, preferences and the system in general?

Surprisingly, Apple does not offer an option to use cloud services for Time Machine. But, like most things Mac, where there's a will, there's a way and I was determined to find it. Well, actually, I didn't have to look that hard. I previously did an article on saving Time Machine backups to a network drive and with a little bit of modification, here's how you can save your Time Machine to OneDrive, Google Drive, iCloud, or whatever your preferred cloud service might be.

Mount the virtual drive On my machine, the virtual drive mounted automatically and MacBookTM appeared on my desktop. If yours doesn't, open Finder and browse to the location where you saved the disk image. Double click on it to mount the image.
How does it work?

For the purposes of this article, I'm using OneDrive but it works in the same way with other services.

Presuming you already have the cloud sync service working on your Mac, following these steps is pretty straightforward and will only take a few moments. We need to create a virtual drive, store it in the cloud service and then mount it to our Mac. With a little bit of tweaking to Time Machine settings, your Mac will then recognise the virtual drive and start saving to it automatically. Whenever macOS saves changes to the virtual drive, the OneDrive app will sync those changes back to the cloud.

Bear in mind, however, your virtual drive will have to be stored on your MacBook as well in order to be accessible to Time Machine and stay in sync with the cloud. You will need sufficient disk space in order to do this.

Create a virtual drive first

The beauty with a virtual drive is, even if you specified the full 1 TB as allocated space for the virtual drive, the actual space being taken up will only be as large as the files contained within.

You want to save the disk image within your cloud drive folder. For me, I just had to browse to the OneDrive folder on my Mac and save the disk image here.

  • Open Disk Utility. You will find this in the Applications folder, or like me, just call up Spotlight and type it in.
  • From the File menu, choose New Image > Blank Image...
  • In the Save As window, browse to your Cloud drive folder and give your virtual drive a name, such as MacBookTM
  • Enter the maximum amount of size your virtual drive should be. For me, I entered 200 GB as it's unlikely my 240 GB MacBook Pro will ever be this full.
  • Make sure Mac OS Extended (Journaled) is selected as the Format.
  • I would recommend choosing Encryption and 128-bit is fine for me. You will be prompted to enter a password so make sure it's something you will remember - you don't want to be teased with a backup that you can't open in times of need!
  • Select the Single partition - Apple Partition Map as the option for Partitions.
  • Finally, choose sparse bundle disk image as the Image Format.
  • Check the size of your disk image - mine kept changing so make sure your allocated size is correct.
  • Click Save.
MacOS will set up your virtual drive. You might be prompted for your password, if you chose an encryption option. You can then quit Disk Utility.

Configure Time Machine to recognise our virtual drive

This bit looks a little tricky but is actually really simple.

  • Open up Terminal, or again, just call up Spotlight and type it in.
  • Type in the command sudo tmutil setdestination /Volumes/{mounted-disk-image} where {mounted-disk-image} is the name of the mounted disk on your desktop, i.e., MacBookTM
  • Press Enter
  • Type in your macOS password if you prompted and press Enter.
  • Type exit and press Enter
  • Quit Terminal

Set up Time Machine

Almost done now!

Open Time Machine from System Preferences and your newly created drive should show up automatically. If it doesn't, click on Select Disk.

Exclude your OneDrive folder from Time Machine

This isn't necessary but I would recommend it. Otherwise, you'll be backing up your cloud sync folder to within Time Machine as well... and then storing it on the cloud sync folder. To exclude a folder:

  • Within the Time Machine Preferences, click on Options
  • Click on the small + icon and select your cloud folder, for instance, OneDrive
  • Click Exclude and then Save

And you're done!

Time Machine will start backing up to your virtual drive and OneDrive will begin syncing those changes back to the cloud. No more having to search for that external hard disk, or waiting to connect to a network server. Let's hope you don't need to use Time Machine's restore facility and it might be a bit of a pain having to download your backup at the time but believe me, it's much more painful losing your stuff!