Counterpart – safely live cloning OS X Server


Pushed yesterday to GitHub is version 1.2 of Counterpart. It adds a helpful feature that makes it incredibly simple to safely live clone OS X server; optional server & database backup.

During a live disk clone, the Open Directory and PostgreSQL databases utilised by OS X server may not be in a consistent state on the disk. Because of this, the cloned database data may be corrupted, and important Server and services data may not be backed up correctly. Counterpart solves this by providing an option to archive Open Directory & dump PostgreSQL to disk before attempting a clone. Whilst this was possible before with the help of a pre-clone script, adding these features directly in Counterpart has made it easier than ever to implement a cloned backup solution on OS X Server.

More information is available in the Counterpart README, but backing up OS X server data is as simple as throwing the new -b flag as follows:

counterpart -s / -d /Volumes/BootClone -b password

A lot more information on exactly how Counterpart achieves its backups and cloning process is available in the README on GitHub.

Counterpart on GitHub


Introducing Counterpart: a live bootable clone tool for OS X

These days, backing up Mac OS X Server is easier than ever, with plenty of options available for taking incremental backups of system and service data, and great support from Time Machine’s ServerBackup process in making sure that databases and Open Directory are included in hourly backups.

All of these great options have one thing in common though: restoration. In a production environment, as lovely as backups are; admins are often hounded by management and users when hardware fails, and time elapses whilst operating systems are re-installed and service data rolled back from backup drives. To combat this downtime, I like to keep a fully bootable backup connected to each production server that is as up to date as possible. In many situations, this allows you to get a slightly data-delayed version of your environment up and running until you can schedule proper downtime to restore backed up data. For years, I utilised Mike Bombich‘s fantastic tool Carbon Copy Cloner, along with it’s excellent Scheduled Tasks functionality for this exact purpose. With it’s recent move to shareware, I decided that there really should be a free, open source script for cloning Mac OS X that can be scheduled with launchd, and provides proper logging and statistical data. It is with this that I announce the release of Counterpart; a wrapper script for rsync on OS X that is capable of producing bootable clones of live Mac systems. I have been using this for a little over 6 months to backup hundreds of OS X systems, and it has made my life so much easier a couple of times during hardware failures.

Counterpart utilises rsync, the fantastic data and synchronisation utility, and wraps it in a script that provides the correct settings and filesystem exceptions to create a bootable clone of a live Mac system, whilst error checking and providing comprehensive logging, statistics and monitoring data. It is bundled with detailed documentation and instructions on scheduling clones. Coming soon is a companion Nagios plugin script to monitor clones and provide performance data, meaning you can be sure clones are completing successfully, and get insights into your backup data like this:

Counterpart Clone Statistics

It should also be said that whilst Counterpart was first envisaged to backup Mac OS X Server instances, there is nothing stopping it being used to back up standard OS X clients, and it would be a great, fully scriptable, free way to create a bootable clone of your OS before an upgrade or significant modification to your system.

I have uploaded Counterpart as a new project on GitHub, and welcome any feedback that you may have on using it. I am also happy to answer any questions on getting it set up in your environment, and I am best contacted using this form.

Counterpart on GitHub


Monitoring thermal sensors on Apple hardware with Nagios

Basic Thermal OverviewThe System Management Controller (SMC) in modern Apple hardware is responsible for a host of functions, one of which is controlling thermal systems within a machine. Having the ability to monitor thermal sensor values in a production Mac server can be very beneficial, providing insight into the ambient and component temperatures of the machine and providing notifications when thermal systems fail.

Added today to my Mac OS X Monitoring Tools project is check_osx_smc, a new plugin that can talk to the SMC in modern Mac hardware to read and report on temperature and fan speed values. It is capable of reporting on multiple sensors at once, checking against set warning and critical values, then returning performance data for further analysis and graphing.

The plugin, written in C/Obj-C, takes a list of SMC registers (keys which point to a particular value), value thresholds for warning and critical states, and a temperature scale (celsius/fahrenheit). In the example below, we are asking an SMC on a Late 2012 Mac mini Server for it’s ambient temperature in celsius as well as it’s primary fan speed:

./check_osx_smc -s c -r TA0P,F0Ac -w 70,5200 -c 85,5800

As the resulting temperature is above 70°C, we get thrown a warning:

WARNING - TA0P is 71.3C, F0Ac at 5354rpm | TA0P=71.3158;70.0;85.0; F0Ac=5354.0;5200.0;5800.0;

A practical example: recently, when the air conditioning unit in a client’s server room failed, the rising ambient temperature in a stack of Mac mini & Mac Pro servers triggered a warning and notification. In this case, cooling was able to be restored before systems started to overheat and go down. Even in a far less dense environment, monitoring the thermal statistics of a single server can help you catch tricky things like overheating components or a fan not maintaining it’s target speed.

The plugin, as well as it’s accompanying documentation, is now available in the OSX-Monitoring-Tools GitHub repository. I hope that it serves you well, and welcome any queries or suggestions anyone may have.

check_osx_smc on GitHub