Giter VIP home page Giter VIP logo

check-time-machine's Introduction

check-time-machine

Python script for checking to make sure all of your files are actually backed up by Time Machine, and offers options for fixing files that are not.

Usage

python checktimemachine.py [path to directory]

If a directory is not specified, checktimemachine.py will scan the entire filesystem of all of the volumes included in latest Time Machine backup and compare to the files contained with that backup.

If a directory is specified, will scan just that directory and compare to its latest backup.

Any missing files will be presented in two lists:

  1. Non-excluded files that are missing: files that are not marked by Time Machine as being excluded but are nevertheless not in your Time Machine backup. This could be because they simply haven't been backed up yet, or it could be because Time Machine has been very naughty and skipped over these files for no good reason.
  2. Excluded files: files that are marked by Time Machine as being excluded, either by sticky exclusion or fixed-path exclusion. (See man tmutil for more information.)

Will then offer to add excluded files to the Time Machine backup, and to "wiggle" the files the non-excluded files that are not backed up. And by wiggle, I mean it will touch the file, touch its containing directory, rename the file, and then rename it back to its original name. Note: this is not guaranteed to accomplish anything, but some users have reported that it helps.

Important notes!

This script will automatically ignore a wide variety of files and folders that, as far as I can tell, are not supposed to be included in a Time Machine backup. This list was created by running the script and seeing what miscellaneous files it finds that I don't care about.

At the top of the script are several lists. Before running this script, you should consider reviewing them and adding any paths you want ignored or remove any paths that are important to you. They are:

  1. excludeDirectories: Directories that have sticky exclusion that I'm pretty sure are safe to ignore.
  2. excludeFiles: Files that have sticky exclusion that I'm also pretty sure are safe to ignore.
  3. excludeExtensions: List of extensions that will be ignored. Can apply to any file or folder.
  4. userIgnore: Files and folders that I personally wanted to ignore but you may feel differently about it. Definitely should review this one.

Please pay close attention to the comments for each of these variables, as they describe what format the paths have to be in and how they are applied.

The script will also ignore anything that would already by excluded by Time Machine based on the contents of the StdExclusions.plist file in the System folder.

check-time-machine's People

Contributors

briankendall avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

miczac eransha75

check-time-machine's Issues

StdExclusions.plist does not Exist in newer MacOS

First of all, thank you Brian for that script. It shows that I am not alone with a unreliable TimeMachine Backup.

Nevertheless I cannot make it work since the StdExclusions.plist seems to have vanished during a later MacOS release. (I am using latest Big Sur 11.2.3) When I run the script, it immediately stops with the following Error:

Traceback (most recent call last):
  File "checktimemachine.py", line 560, in <module>
    initialize()
  File "checktimemachine.py", line 549, in initialize
    readStdExclusions()
  File "checktimemachine.py", line 544, in readStdExclusions
    excl = plistlib.readPlist('/System/Library/CoreServices/backupd.bundle/Contents/Resources/StdExclusions.plist')
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plistlib.py", line 75, in readPlist
    pathOrFile = open(pathOrFile)
IOError: [Errno 2] No such file or directory: '/System/Library/CoreServices/backupd.bundle/Contents/Resources/StdExclusions.plist'

I tried to find out where that exclusion file is located now. That was not successful. Maybe someone else has a hint.

script stops when running from / but one volume is not mounted - how to check / ?

Hello, many thanks for this script!
This is on macOS 10.12.6, trying to back up a couple of external volumes.

$ sudo python ~/Downloads/checktimemachine.py 
*** Checking volume: 230GB-1
Getting list of files from source volume...
...found 20000      
Done
Getting list of files from Time Machine backup...
...98%-ish complete      
Done

Comparing, 100% complete      
Done
*** Checking volume: DATA-1TB-01
Getting list of files from source volume...
Error: "" does not exist on disk. Cannot continue!

I suspect it's simply because this DATA-1TB-01 disk is not mounted but, of course, has backups.
Is there a chance to scan / without unmounting all the disks?
Thanks a lot - Michael.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.