rustic-rs / rustic

rustic - fast, encrypted, and deduplicated backups powered by Rust
https://rustic.cli.rs
Apache License 2.0
2.01k stars 73 forks source link

Feature request: ignore files excluded by timemachine files #1074

Open ibash opened 9 months ago

ibash commented 9 months ago

As a mac user I use time machine backups. It'd be great if rustic was able to ignore files I have already ignored in my time machine plist.

Currently I use restic backups and have a wrapper script that produces an excludes.txt with these files. There are two sources of files ignored by time machine:

  1. Parse out SkipPaths from the plist located at /Library/Preferences/com.apple.TimeMachine.plist
  2. Looking at per-file metadata: sudo mdfind "com_apple_backup_excludeItem = 'com.apple.backupd'"
kapitainsky commented 9 months ago

I am afraid it is not so simple... your wrapper is missing a lot. You only include your explicit TM exclusions + 3rd parties software indications what to exclude. You are missing entirely macOS default exclusions. With your approach your backup most likely includes such red herrings as ~/Library/Caches

Have a look at my post here:

https://forum.restic.net/t/exclude-patterns-for-caches/7219/5

Also I do not think it should be rustic problem - it is platform specific issue. rustic should not worry about what and how some Apple software (Time Machine) is doing - especially that it is not documented by Apple itself. As what next? Should rustic be aware of any other backup software? You want to maintain it?

Or talk to Apple - ask them to document how to get TM exclusions - then it should be easy to create wrapper or maybe consider some macOS specific rustic behaviour. Without, it is pointless even to try - unless you volunteer to reverse engineer TM behaviour and maintain it moving forward. My approach in link included is simply based on poking around - no help from any official sources. So it might be not perfect neither - but it is the best I managed to figure out.

ibash commented 8 months ago

oo thanks @kapitainsky

It wouldn't need to belong in rustic, maybe there's room for a small utility program to generate exclusion lists.

kapitainsky commented 8 months ago

100% agree. macOS users will love it. Hopefully somebody will write it one day.

ibash commented 7 months ago

Now that I'm actually working on switching to rustic, would love to exclude by the com_apple_backup_excludeItem attribute. This is something duplicacy supports and would catch a lot of things :)