Skip to content

Instantly share code, notes, and snippets.

@michaellopez
Forked from jb510/readme.md
Created December 3, 2020 12:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michaellopez/4bcade1406925860ade6fb7533577bf3 to your computer and use it in GitHub Desktop.
Save michaellopez/4bcade1406925860ade6fb7533577bf3 to your computer and use it in GitHub Desktop.
Exclude vcs (git, svn, hg) and node_modules from Backblaze backups on Mac

Backblaze's bztransmit process loads a file called bzfileids.dat into RAM. This file is a list of all files Backblaze has previously uploaded, including a unique identifier for each file. On most systems, this files is under 100MB in size (paraphrased from Backblaze support rep Zack).

Mine had grown to 6GB. This means that anytime bztransmit runs, it will load this 6GB file into RAM while it is backing up. In doing so it was purging massive ammounts of memory causing behavior like Chrome (usign 10GB of memory on it's own) to hang/beachball for 30 seconds and then refresh all it's windows.

There is no way to alter this behavior once it's begun, aside from starting over with some files excluded. The index needs to be rebuilt from scratch without the excessibe file count, that also means you can't restart and "inherit" a previous backup.

In my case the biggest culprits were .git and node_modules, so I excluded those, started a new backup (transfered licnese) and spent a week hunting for fast internet I could stay connected to over night.

Here are those exclusions

Exclude Version Control System (VCS) folders like .git, .svn and .hg, and exclude node_modules from Backblaze backups on Mac

  1. Edit the file at /Library/Backblaze.bzpkg/bzdata/bzexcluderules_editable.xml.
  2. Add this rule inside the bzexclusions tag:
<!-- Below here is for node_modules. -->
<excludefname_rule plat="mac" osVers="*"  ruleIsOptional="t" skipFirstCharThenStartsWith="users/" contains_1="/node_modules/" contains_2="*" doesNotContain="*" endsWith="*" hasFileExtension="*" />

<!-- Below here is for Version Control Systems (VCS) for things like: .git, .svn, .hg -->
<excludefname_rule plat="mac" osVers="*"  ruleIsOptional="t" skipFirstCharThenStartsWith="users/" contains_1="/Sites/" contains_2="/.git/" doesNotContain="*" endsWith="*" hasFileExtension="*" />
<excludefname_rule plat="mac" osVers="*"  ruleIsOptional="t" skipFirstCharThenStartsWith="users/" contains_1="/Sites/" contains_2="/.svn/" doesNotContain="*" endsWith="*" hasFileExtension="*" />
<excludefname_rule plat="mac" osVers="*"  ruleIsOptional="t" skipFirstCharThenStartsWith="users/" contains_1="/Sites/" contains_2="/.hg/" doesNotContain="*" endsWith="*" hasFileExtension="*" />

Notes

It can take one to eight hours before new files are backed up. If you want to test this has worked, best to wait a day or so. https://help.backblaze.com/hc/en-us/articles/217665498-Why-hasn-t-Backblaze-backed-up-my-new-files-yet-

Adding this rule does not remove existing files/folders that have already backed up. You need to start over if you want to have a reasonably sized bztransmit RAM footprint.

References

Bonus - What about Time Machine?

Check out @stevegrunwell's Asimov for doing something similar with Apple Time Machine https://github.com/stevegrunwell/asimov

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment