From what I’ve observed (I’m helping an organisation move their file server to OneDrive), the cache directory on the external drive is your local copy of the OneDrive files as you say – those that are selected to remain on the device, and those in active use. The files in the CloudStorage location aren’t ‘linked’ to the cache directory – they are separate files that are downloaded and purged (replaced with placeholders) as needed, with no guarantee that any of them will keep their data on the disk. But it seems that the CloudStorage location considers the cache directory to be the ‘remote’ cloud source. So when it needs a file, it ‘downloads’ it from the cache directory, and when a file is changed or created, it ‘uploads’ the changes back to the cache directory (on the external drive). I visualise it as:
👱user <--> ~/Library/CloudStorage/OneDrive <--> /Volumes/ExternalDrive/OneDrive/.ODContainer <--> onedrive.com
It’s the cache (.ODContainer
) that follows the retention rules you’ve set and communicates with Microsoft’s cloud storage. The user interacts with the CloudStorage/OneDrive
folder (which MacOS sees as the sync folder), and this folder retrieves and stores data from/to the .ODContainer
folder. All user interaction is with the CloudStorage/OneDrive
folder – including setting retention rules, even though the retention actually takes place in the cache folder. So if you’re offline, all the files marked to keep on device are available to you, even if they’re not in CloudStorage/OneDrive
when you go offline.
One side-effect of this architecture is that if you have a folder (e.g. on an external drive) that’s larger than the space available on the disk holding your home directory, you can’t add it to OneDrive all at once. You have to add it in segments that fit within the available disk space, as it has to first be copied to ~/Library/CloudStorage/OneDrive
, after which OneDrive will copy it to the .ODContainer
cache folder on the external drive (where it will upload to Microsoft’s servers from). Once the files are in the cache folder the files in ~/Library/CloudStorage/OneDrive
will be marked as purgeable so you can copy over the next batch of files. Of course, if you have a single file that is larger than the available space on the disk holding your home folder, you can’t add it to OneDrive through the Finder. You’ll have to use the web interface to upload it. Once it’s in OneDrive, I assume you can mark this large file to be always available, as that would download it to the external drive. But I imagine it would cause problems if you try and access the file from your Mac, as OneDrive won’t be able to copy it from the external drive to ~/Library/CloudStorage/OneDrive
.
Overall, I think Microsoft came up with a decent and reasonably clever solution given the constraints. And they get points for putting in the effort to get something to work, compared with Dropbox who seem to have just given up and said there’s no support for using an external drive for your Dropbox folder. (I never thought OneDrive would provide a better Mac solution than Dropbox, but it’s a sign of how from its roots Dropbox has strayed.)
However, what should really happen is that Apple needs to add more flexibility into the cloud provider APIs. Moving CloudStorage
to an external drive (or another location on the internal disk) should be supported by MacOS natively. I understand why Apple wants to standardise file syncing on MacOS, and in theory it should benefit users. But they need to do it properly, supporting more than the simplest use case.