This is the website of Abulsme Noibatno Itramne (also known as Sam Minter). Posts here are rare these days. For current stuff, follow me on Mastodon



June 2010

Getting Backblaze Statistics from the Command Line on a Mac

I’ve been trying to keep a little dashboard showing how well Backblaze is doing keeping up with backing up my primary system (a Mac). I’d been doing this by hand every once in awhile by just taking the numbers of files and MB left shown by their icon in the menu bar. But that was manual and tedious. I wanted to automate it. I Googled a number of times things like “Backblaze Command Line” to try to find a way to pull this info, but never found anything useful. I poked around a bit looking for relevant log files, but didn’t find them until tonight. I found what I needed, so I thought I’d post so that if anybody else is looking to do the same thing, when they Google, they will find the answer, rather than having to dig and find this from scratch. Of course this is just for the Macintosh version. I am sure there is something equivalent in their Windows software, but I don’t have a Windows machine, so I’m not going to be the one to find it there.


It turns out what you need is all in a nice little file:


The contents are pretty straight forward:

<?xml version=”1.0″ encoding=”UTF-8″ ?>
<remaining remainingnumfilesforbackup=”2414327″ remainingnumbytesforbackup=”459544254971″ />

So, for remaining files needing to be backed up:

cat /Library/Backblaze/bzdata/bzreports/bzstat_remainingbackup.xml | grep remaining | cut -d \” -f 2

And for remaining bytes needing to be backed up:

cat /Library/Backblaze/bzdata/bzreports/bzstat_remainingbackup.xml | grep remaining | cut -d \” -f 4

I use these together in a quick little shell script that I run every few hours using cron:

# Updates BackBlaze Stats
date “+%m/%d/%Y %H:%M:%S” | tr -d ‘\n’ >> $FCFILE
echo -ne ‘\t’ >> $FCFILE
cat /Library/Backblaze/bzdata/bzreports/bzstat_remainingbackup.xml | grep remaining | cut -d \” -f 2 >> $FCFILE
date “+%m/%d/%Y %H:%M:%S” | tr -d ‘\n’ >> $MBFILE
echo -ne ‘\t’ >> $MBFILE
cat /Library/Backblaze/bzdata/bzreports/bzstat_remainingbackup.xml | grep remaining | cut -d \” -f 4 >> $MBFILE

My actual script actually does one more thing to convert bytes to megabytes for my charts, but the above gets you the raw data. What you do with it after that depends on your application and what you are trying to do with this info.

For me, I’m generating dashboard charts:

Everything prior to 2010 Jun 10 was me grabbing data manually for the graph. June 10th forward is pulled automatically by the above.

Anyway, hope this ends up being helpful for anybody else wanting to programmatically monitor how well Backblaze is or is not keeping up.

Edit 2012 Jul 9 13:02 UTC: In recent versions of Backblaze, the path that contains the report has changed to /Library/Backblaze.bzpkg/bzdata/bzreports/ .

3 comments to Getting Backblaze Statistics from the Command Line on a Mac

  • If anybody is curious, the “reports” files on Windows are identical in every way to the files on the Macintosh. At Backblaze we develop both the Mac and Windows versions in the same source tree and they share a massive amount of base level library code between them. One Windows, the “bzstat_remainingbackup.xml” file can be found here:

    Windows XP: C:\Documents and Settings\All Users\Application Data\Backblaze\bzdata\bzreports\bzstat_remainingbackup.xml

    Windows Vista and Seven: C:\ProgramData\bzdata\bzreports\bzstat_remainingbackup.xml

    For the programmers poking about in these files, it is ok for your scripts to read them quickly from time to time (this is what they are designed for), but please do not open the files exclusively and hold them open, Backblaze needs to update them. :-)

    — Brian Wilson
    CTO, Backblaze

  • Thanks for the additional information Brian!

  • Hello Brian, don’t know if you set this thread to email you when there were new comments or not, but thought I’d follow up here before trying to ping elsewhere. I’ve now been monitoring the Backblaze stats mentioned above for awhile, and am seeing something I don’t understand:

    Files left:

    MB left:

    Age of last backup:

    (That last is in Ms, multiply by 11.6 to get days…)

    Anyway, a couple of weeks ago, the “Date of last backup” started reporting that the backup was up to date, no more than a few days old. But yet the number of files left remains over 2 million, with over 250 GB remaining. I have verified a few recent files, and the ones I spot checked are indeed backed up on backblaze, but if things were truly caught up, shouldn’t files and MB remaining also be bouncing around the bottom of a chart like this, rather than still showing so much left to back up?

    (Note, in March I upgraded to a new computer… restoring from the Time Machine archive of the old computer. Backblaze picked up and started backing up again, but once it got to zero files remaining it didn’t recognize any further changes until I upgraded the backblaze client, at which time it suddenly seemed to think it had to back up EVERYTHING again from scratch… it has been catching up from that ever since.)

    Anyway, let me know your thoughts. How does it saying it is generally caught up and keeping up jive with the huge backlog still reported in the other metrics? I would expect to generally have some non-zero amount of backlog due to daily churn in my files, but while I do probably have a decent amount of churn, it is not on the order of 250 GB!

    Thanks for your help!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.