Skip to content

Exclude application data directory from backups#1660

Open
somiljain2006 wants to merge 13 commits into
apple:mainfrom
somiljain2006:Container-Backup-Exclusion-fix
Open

Exclude application data directory from backups#1660
somiljain2006 wants to merge 13 commits into
apple:mainfrom
somiljain2006:Container-Backup-Exclusion-fix

Conversation

@somiljain2006

@somiljain2006 somiljain2006 commented Jun 7, 2026

Copy link
Copy Markdown

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Motivation and Context

[Why is this change needed?]

Fixes #1554

The application data directory (~/Library/Application Support/com.apple.container) can contain large, sparse files whose apparent size is significantly larger than their allocated size. This may cause backup tools to process unnecessary data or fail when backing up the container application data.

This change marks the application root directory with URLResourceKey.isExcludedFromBackupKey, preventing it from being included in backups while preserving normal container functionality.

Testing

  • Tested locally
  • Added/updated tests
  • Added/updated docs

Automated Testing:

  • Added test coverage for backup exclusion behavior.
  • Verified all existing tests continue to pass.

Manual Verification:

  1. Built locally with make.
  2. Started the API server using ./bin/container system start.
  3. Verified ~/Library/Application Support/com.apple.container was created.
  4. Verified isExcludedFromBackupKey == true.
  5. Confirmed normal startup completed successfully.

@somiljain2006

somiljain2006 commented Jun 8, 2026

Copy link
Copy Markdown
Author

@jglogan @katiewasnothere @realrajaryan Can you review this pr?

@jglogan jglogan requested a review from dkovba June 15, 2026 17:40
@somiljain2006 somiljain2006 force-pushed the Container-Backup-Exclusion-fix branch from c6b50c0 to 27af44b Compare June 15, 2026 22:46
@somiljain2006

Copy link
Copy Markdown
Author

@dkovba CI failure appears unrelated to this change.

Comment thread Tests/ContainerAPIServiceTests/RuntimeConfigurationTests.swift Outdated
Comment thread Sources/Services/ContainerAPIService/Server/Containers/ContainersService.swift Outdated
Comment thread Sources/Services/ContainerAPIService/Server/Containers/ContainersService.swift Outdated
@somiljain2006 somiljain2006 requested a review from dkovba June 16, 2026 06:25
@somiljain2006

Copy link
Copy Markdown
Author

@dkovba, I have addressed the changes. Can you review them

Comment thread Package.swift Outdated
Comment thread Sources/Services/ContainerAPIService/Server/Containers/ContainersService.swift Outdated
Comment thread Tests/ContainerAPIServiceTests/ContainersServiceTests.swift Outdated
Comment thread Tests/ContainerAPIServiceTests/ContainersServiceTests.swift Outdated
@somiljain2006 somiljain2006 requested a review from dkovba June 16, 2026 22:57

@dkovba dkovba left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the contribution 👍

Comment thread Package.swift Outdated
Comment thread Sources/Services/ContainerAPIService/Server/Containers/ContainersService.swift Outdated
@somiljain2006 somiljain2006 requested a review from dkovba June 17, 2026 22:44
Comment thread Tests/ContainerPluginTests/RootPathTests.swift Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Request]: Exclude application data from backups via isExcludedFromBackupKey

3 participants