Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Arak

macrumors member
Original poster
Feb 13, 2017
43
6
A statement is to encounter in the field that extended attributes (file system) exist to set Time Machine exclusion rules. I got that those attributes are to be set on backup source side to exclude file system items from being backed up by Time Machine. Myself was however not lucky to find a list of attributes in mind. Any ideas?
 

Brian33

macrumors 65816
Apr 30, 2008
1,471
371
USA (Virginia)
There is an extended attribute that can be set on a file system object (e.g., file or directory) which is supposed to tell Time Machine not to back up that object. The best way to set or clear that extended attribute is with tmutil addexclusion and tmutil removeexclusion commands. Enter man tmutil in Terminal to read the details about this.

Set an exclusion for "myfile": tmutil addexclusion myfile

Display the extended attributes (and their values) of "myfile": xattr -l myfile

On Monterey 12.7.6, it appears that the extended attribute name is com.apple.metadata:com_apple_backup_excludeItem
and its value is bplist00_com.apple.backupd

Remove the backup exclusion for "myfile": tmutil removeexclusion myfile

I would test Time Machine to be sure that these exclusions actually work before relying on them.
 

gilby101

macrumors 68030
Mar 17, 2010
2,920
1,616
Tasmania
To add to the reply from @Brian33:

You may be amazed how many files already have the xattr set. The xattr is recognised by Spotlight and you can see all the excluded files with sudo mdfind "com_apple_backup_excludeItem = com.apple.backupd" | sort | less.

To check the status of a single file/folder use tmutil isexcluded <file path>.
 
  • Like
Reactions: Brian33

Arak

macrumors member
Original poster
Feb 13, 2017
43
6
There is an extended attribute that can be set on a file system object (e.g., file or directory) which is supposed to tell Time Machine not to back up that object. The best way to set or clear that extended attribute is with tmutil addexclusion and tmutil removeexclusion commands. Enter man tmutil in Terminal to read the details about this.

Set an exclusion for "myfile": tmutil addexclusion myfile
...
Good hint, tbh myself never consulted description of command's verb addexclusion as I expected it be doing identical stuff as Options... in Time Machine Preferences (System Preferences GUI). There is the plist file in /Library/Preferences folder which handles fields ExcludeByPath and IncludeByPath. Had always this mechanism in front of my eyes.
Do you mean tmutil addexclusion -p myfile be conducting what Time Machine Preferences options utilize while same verb free of flags conducts setting of extended attribute file system level?

Regarding Time Machine plist file and ExcludeByPath and IncludeByPath i wonder if
* these support wildcard characters as well, and
* one can use IncludeByPath to set exclusion from ExcludeByPath - let's consider some folder sub-tree with its root folder be present in ExcludeByPath setting but certain path deep in that sub-tree be present in IncludeByPath?
 

gilby101

macrumors 68030
Mar 17, 2010
2,920
1,616
Tasmania
Do you mean tmutil addexclusion -p myfile be conducting what Time Machine Preferences options utilize while same verb free of flags conducts setting of extended attribute file system level?
Firstly, tmutil addexclusion -p myfile must refer to an absolute path, not a relative path. So it would be something like tmutil addexclusion -p /Users/xxx/myfile or tmutil addexclusion -p ~/myfile

In answer to the question, yes. An exclusion with the -p adds it to the list showed by TM's Options. Without the -p the extended attribute is created. Try it!
Regarding Time Machine plist file and ExcludeByPath and IncludeByPath i wonder if
* these support wildcard characters as well, and
By experiment a tmutil addexclusion -p <path with wildcard> enumerates the wildcard and adds a fixed path exclusion for each of the files or folders which meet that wildcard.
* one can use IncludeByPath to set exclusion from ExcludeByPath - let's consider some folder sub-tree with its root folder be present in ExcludeByPath setting but certain path deep in that sub-tree be present in IncludeByPath?
I have not tried this, but I expect the answer is no.
 
  • Like
Reactions: Brian33

Arak

macrumors member
Original poster
Feb 13, 2017
43
6
One further observation. As for Catalina here couple of exclusion rules were added Mavericks time and persist till today (user's/administrator 's intention). So far only System Preferences > Time Machine was used to manage user-defined exclusions. Set of mentioned exclusions are listed (as of today) on the list SkipPaths (/Library/Preferences/com.apple.TimeMachine.plist). These are couple of items in /Applications folder big regarding their size. ExcludeByPath same .plist file list covers one single item, the user and administrator are not familiarized with and attribute com.apple.metadata:com_apple_backup_excludeItem set to bplist00_??com.apple.backupd, ?? stands for 0x10 0x11. Latter one appears to myself as been set once by operating system.

Hence my understanding so far System Preferences > Time Machine > Options > list of exclusion rules be placing user input to SkipPath variable in Time Machine config .plist. Same way as tmutil addexclusion does as you pointed it out. This applies while system seesm to use separate list in Tiime Machine .plist file.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.