Functions OneDrive and Time Machine? The very best methodology to Repair One Annoying Error with time Machine Simply!

I love the simplicity of using Apple’s Time Machine for doing backups. You plug in an external hard drive, and magically it will create backups and snapshots in the background. That is until you get a cryptic error like “An error has occurred while copying files.” Huh?! Ok, tell me more, Time Machine! But, part of “keeping things simple” means hiding away the details of what is causing a Time Machine error. After some digging around, I found the easy fix to this Time Machine error, and it hasn’t occurred since I corrected the problem. It turns out, in my case, Microsoft OneDrive and Apple Time Machine were not playing nicely together.
I’m actually not a stranger to Time Machine errors. Back in 2019, I was getting Error Type 11 issues with my backup. There are some good troubleshooting tips in that Fix-It article, so if what you find in this article doesn’t help, I encourage you to look at that one as it has more general approaches to fixing Time Machine errors. This How-To article is a bit more specific. But it took a while to figure out what was exactly causing it.
This Fix-It article tells you how to find the logs that may be showing the specific error and then use that information to correct it. There may be some other Time Machine errors that you encounter in the process that you can identify and fix as well. (Hint: if you don’t care about how I figured this out and just want the fix, skip to the end of the article.)
The Time Machine Error & Getting Details On It
Here’s what happened. For quite a while, Time Machine was just chugging along, doing its thing. Then, I started getting alerts saying that the Time Machine backup had failed. When I went to the Time Machine preference pane within the System Preferences, there was the usual red circle information icon.

Clicking on the red information icon launched an “amazingly informative” description of the error. It said: “Time Machine couldn’t complete the back to ‘Time Machine Backup’” (obviously, if you encounter this error, instead of “Time Machine Backup,” it would be the name you gave your backup drive).
But then came the super-informative Time Machine error message: “An error occurred while copying files.” That’s it.
As some quick troubleshooting, I did some of the tips I mentioned in my other repair article, including the Disk Utility to analyze and repair the backup drive. And actually also completely reformatting the backup drive and starting the Time Machine process from scratch. I did this a few times.
But the error would keep coming back. Not after the first few backups, but a while later. It was extremely odd. And, I couldn’t get any information on it because, as I said, Apple likes to hide the error details away.
I realized I needed to look at the log files to see exactly what Time Machine was complaining about. But Time Machine doesn’t have easy to access log. I checked in the Console utility app, but there was too much information to go through; it wasn’t an efficient way to do this.
This is where a Terminal command actually helped me tremendously. Because macOS is essentially Apple’s version of Linux (sort of), using the Terminal app can be extremely powerful, useful, and helpful. Linux commands can be executed from within the Terminal app, giving you superpowers you didn’t know you had.
First, let me say I am NOT a Linux expert. Nor do I pretend to know much if anything about working with the command line. What I do know is that there are lots of really smart people who do Linux commands all of the time – these people are geek gods in my mind!
I have, however, run enough Linux commands to have a decent understanding of them. And to truly appreciate their power.
I digress. Let me share the Linux command that helped me figure out this particular issue with Time Machine (and how I came to learn that Microsoft OneDrive was the culprit).
Using Terminal to get Time Machine Errors
I needed the details. What was causing this error? After searching around for an easy way to get detailed Time Machine logs, I stumbled across the Terminal command that would allow me to do this. Here it is:
printf ‘e[3J’ && log show –predicate ‘subsystem == “com.apple.TimeMachine”‘ –info –last 6h | grep -F ‘eMac’ | grep -Fv ‘etat’ | awk -F’]’ ‘{print substr($0,1,19), $NF}’
I can’t tell you exactly what all of this translates to. It says to look into the “com.apple.TimeMachine” log and look at the past 6 hours (note, you can change that number). It will also look for the phrases “eMac” and “etat” and then print it all to the screen. You just run that command using the Terminal app which is found in the Utilities folder.
It turns out this was exactly what I needed. I did decide to reformat my backup drive one more time and then let the backup run overnight without me using my Mac – I wanted to run the command right after the error appeared. So I did just that, and voila, the error popped up again.
I ran the command.

I was a bit shocked by the result. The log file was huge. I saved the results as a text file, and that file was 72 MBs in size!!! Ummm…that’s a lot of errors. (By the way, after doing the fix that I note later in this article, I reran the same command. The resulting file size was only 41 KB! So something did, obviously, work.)
So, I started digging through the errors and started to notice a common thing. Almost 100% of the “Failed to copy” errors were for files that resided on my local machine’s OneDrive!
The Culprit: Microsoft OneDrive
When I started to think about it, that made absolute sense. Microsoft OneDrive is a complicated beast. And, there is a feature that I love and use within OneDrive that I am guessing may have been confusing Apple’s Time Machine. Within OneDrive, you can make some files on-demand to save space on your laptop. The file name exists, but the file is essentially just a pointer to something stored in the cloud. I wrote about on-demand and select-sync, two extremely useful OneDrive features.
If, for example, you have an image that is marked as on-demand and you want to preview it by tapping on the space bar, you won’t get a preview. You will need to store the file locally to be able to do that.
I hypothesize that Time Machine was getting confused with these virtual or pointer files. It was trying to back up these files but not being able to because they weren’t really there to back up. So that is why it said an error had occurred.

You could, I guess, allow Time Machine to have the permission to download the files in the OneDrive drive automatically. Still, I think that would completely defeat the purpose of using the on-demand aspect of OneDrive because Time Machine would automatically keep copies locally.
The whole point of the on-demand feature of OneDrive is to keep things in the cloud and save space on your hard drive.
Then I started to think…if everything within my OneDrive directory is already synced within the cloud, why the heck do I need to take a Time Machine backup of that entire directory?
At that point, I had two reasons why I really didn’t need OneDrive to be backed up by Time Machine:
it was causing errors because of the on-demand feature, I believe, and it was already backed up to the cloud.
The Fix: Exclude OneDrive from the Time Machine Backup
Long story short (TL;DR version), the way that I fixed this was to simply exclude my Microsoft OneDrive directory from the Apple Time Machine Backup. Honestly, you don’t need to do it since that directory is already in the cloud and backed up there.
To exclude a directory from Time Machine, simply open the Time Machine System Preferences pane. Then click on the Options… button.

Next, click on the + button to add a directory (or file) to the exclude list. Another window will open when you do that, allowing you to navigate to the directory you want to exclude. In this case, I selected my personal OneDrive account (I do have a Business one as well).

And once you click on the Exclude button, OneDrive will show up within the “Exclude these items from backups” list. Just click Save and you are done.

Now, all that you have to do is let Time Machine work its magic! So I let it run a few days before I declared victory. And to be sure, I ran the Terminal command I listed earlier multiple times a few hours and days apart. And as I mentioned before, the Time Machine error disappeared (the log file went from 72 MB to 41 KB, and there was no sign of any file copying errors within the error log).
Also, interestingly, because I had put my personal OneDrive directory into the exclusion list, when I tried to put my Business OneDrive directory into the same list, it was greyed out and couldn’t be selected.
But that was the easy fix! I just had to figure out what was causing the generic Time Machine error; that was the hard part. (Removing the OneDrive directory actually has sped up my backup as there are fewer files to process.)
Do leave a comment if this fix helped you or if you encountered another type of error that couldn’t be resolved like this.
HTD says: The lesson I learned from troubleshooting a Time Machine backup error of not being able to copy a file was that perhaps some things don’t even need to be backed up in the first place! Especially if it is OneDrive which is already backing things up in the cloud.
– Advertisement — Advertisement –

– Advertisement –