2

In macOS 10.15.3, using Time Machine Preferences GUI I have excluded /usr and /System from backups.

In the terminal I get:

% tmutil isexcluded /usr/      
[Excluded]    /usr

% tmutil isexcluded /usr/local/       
[Included]    /System/Volumes/Data/usr/local

I was expecting /usr/local to be recursively excluded but it isn't. Why? How can I excluded things recursively?

1
  • Comments are not for extended discussion; this conversation has been moved to chat.
    – bmike
    Apr 2, 2020 at 22:10

1 Answer 1

2

Yes, directory exclusion are recursive. This means that if you exclude for example ~/MyDocuments/ then everything in that folder and beneath is excluded. That includes for example ~/MyDocuments/SubFolder/document.docx.

However, there are some special cases. When you have a non hard-link, the link itself is excluded, but the link is not followed to exclude the objects linked to. This means that a symbolic link or firm link, like you have in your case, is excluded from the backup - but not what it links to.

In your case /usr/local is not really a subfolder of /usr, but rather a link. This is the reason you see that /usr/local, which is really /System/Volumes/Data/usr/local, is not excluded when you exclude /usr.

Note that excluding a directory does not exclude the volumes mounted under that directory. For example sudo tmutil exclude -p /System will only exclude directories in the volume / (but not other volumes mounted to /System/Volume/ e.g. /System/Volume/Data/).

According to the man page:

The third kind of exclusion is a volume exclusion. These track volumes based on file system UUID, which is persistent across volume name and mount path changes.

Therefore sudo tmutil exclude -v / will exclude folders and volumes (including /System/Volume/Data/).

7
  • 2
    To avoid any confusion, the last paragraph of this answer, at the time of this comment, is not valid for macOS Mojave and earlier. It is however only valid for macOS Catalina at the present time, and assuming so for macOS releases beyond. Apr 2, 2020 at 15:00
  • As mentioned in the question, System was also excluded.
    – Loax
    Apr 2, 2020 at 20:53
  • @user3439894 Thanks for the clarification. The situation described in the question was indeed on macOS Catalina.
    – Loax
    Apr 2, 2020 at 20:55
  • 1
    @Loax, RE: "The situation described in the question was indeed on macOS Catalina" -- I am well aware that you are running macOS Catalina, however, nowhere was that explicitly mentioned in the OP, the answer, or comments till mine, and as such I felt it was pertinent for others reading this answer that there was explicit distinction of what "In your case ..." was actually referring to. I'm sure there are still many users unaware of all the changes made in macOS Catalina that are not at all pertinent to previous versions of macOS. Apr 2, 2020 at 21:06
  • 1
    @Loax anyone can propose edits to an answer or question. Why not accept this and make the edits. If the edits are rejected you can remove the accept or make your own answer and tick the accepted there. Great question to clarify how firm links are different than hard links and how it’s not a traditional over mounted filesystem on macOS Catalina.
    – bmike
    Apr 2, 2020 at 22:13

You must log in to answer this question.

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