0

While looking at the log files for Time Machine, I realized that the previous backups were not being deleted due to an error with a single file:

2023-07-16 05:50:29.434071-0700 [BackupThinning] Deleted incomplete backup '/Volumes/Backups/2023-07-15-074409.previous'
2023-07-16 05:50:29.557540-0700 [BackupDeletion] Failed to unlink item '/Volumes/Backups/2023-07-15-120039.previous/Data/Users/xxx/Library/CloudStorage/[email protected]/My Drive', error: Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"

I do not understand what is wrong with this link in particular. It was created by Google Drive. I uninstalled, deleted the entire [email protected] folder then reinstalled Google Drive and it is the exact same issue.

> cd ~/Library/CloudStorage/[email protected]
> ls -la 
...
lr-x------@     1 xxx  staff       24 Jul 16 05:44 My Drive@ -> /Users/xxx/My Drive
> cd /Volumes/Backups/2023-07-15-120039.previous/Data/Users/xxx/Library/CloudStorage/[email protected]
> ls -la
lr-x------@     1 xxx  staff  24 Jul 15 09:29 My Drive@ -> /Users/xxx/My Drive
> rm -f "My Drive"
rm: My Drive: Operation not permitted

The only thing that seems to work is to issue a manual sudo rm -f "My Drive".

Any idea what is wrong with the link that Google Drive creates that cannot be deleted by Time Machine and what to do to fix it?

1 Answer 1

0

I experienced the same problem. The root of the issue seems to be that the "My Drive" file is marked immutable (or in Finder lingo, it is "locked"). You can see this on the command line with ls -lO@e, and you will see the uchg flag attached to the "My Drive" file. In Finder, you can just do Get Info on the file. In Finder, you can unlock the file from the Get Info box, or from the command line, run sudo chflags nouchg "My Drive".

Change this flag recursively for all .previous versions in Time Machine, and on the next backup, Time Machine will be able to prune the various .previous snapshots that have been blocked by the uchg flag.

To prevent this problem on future Time Machine snapshots, be sure to unlock / unflag the original "My Drive" file on your main drive.

The one caveat is whether it is safe to unlock/unflag the "My Drive" file, I cannot say.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .