The great thing when tinkering with the Raspberry Pi, be it for a digital picture frame project or anything else, is that you can quickly start with a clean slate like an Etch a Sketch.
And with an image that contains a snapshot of your work before you did something that you would regret later, you can save a lot of time.
In this article, I want to introduce you to ApplePi Baker, a smart Backup & Restore software for macOS, which has saved me countless hours. If you are working on macOS besides your Raspberry Pi, this is the software to use.
Born out of frustration
ApplePi Baker is the product of Hans Luitjen, a genuinely nice fellow from The Netherlands who has a passion for inventing things.
He publishes a blog called Tweaking4ALL where he writes about all kinds of soft- and hardware tweaks ranging from 3D printing, Home Theatre, Music, and Software Development.
The software gem ApplePi Baker was born out of frustration that existing methods and tools to get an operating system on an SD-card were not great and the time was ripe for a new approach.
That was back in 2014, and although several software solutions have been introduced in the meantime, Hans has kept on improving ApplePi Baker with the current version 2.
Why you should back up your SD-card
I believe ApplePi Baker is still by far the most versatile tool for backup and restoring an SD image if you are macOS-based. It is not limited to work related to the Raspberry Pi, but this is where I use it most often.
Software like Balena Etcher offers a solution for flashing SD cards, but they don’t provide a way to backup an SD card. ApplePi Baker does both, backing up and restoring.
I often use it to make a snapshot of an image when I am working on something new and would like to keep the basic setup of the current operating system and my other tweaks. This way, I can try new things, and in case it doesn’t work, I can just revert to the old image quickly without having to go through the entire process of re-installing the operating system and additional packages.
Another use case is to back up the SD-card of my “production” digital picture frame. If someday, the SD-card might die on me, I have an immediate working replacement that works and keeps the wife happy. The images that have been added between the time of my last backup and the time of SD-card failure will automatically by synched through Syncthings, so everything will be back to what it was before.
By the way, if you have a home automation software like Home Assistant running on a Raspberry Pi, it is also a safe practice to back up the SD card every once in a while. When the lights go out because of card failure, you have an immediate replacement at hand.
As 32GB SD cards don’t cost much at all anymore, this is an easy way to have some peace of mind.
Why ApplePi Baker is my preferred tool
The latest version of ApplePi as of May 2020 is V 2.2.3, which has been updated to fully support macOS Catalina.
At its core, it uses the same format as produced by “dd“, a raw byte-by-byte copy of the disk – typically with the “.IMG” file extension. The IMG file format is a raw copy of every single byte of the source disk which also means that if your disk is 32GB, even though you may be using only 1 byte, your backup file will still be 32GB!
But where ApplePi Baker shines is that it supports automatic shrinking and expanding of Linux partitions. This means that if your 32 GB is only filled with 5 GB, your IMG file will only have a size of 5 GB, or even less. This is most convenient if you want to store the backup images on a hard disk.
Using this option will make a backup or restore longer, but the convenience of the saving in disk space makes up for it.
ApplePi Baker supports many different formats for the backup process like 7Zip (extension: .7z), IMG (extension: .img), Tar BZip2 (extension: .tbz), Tar GZip (extension: .tgz), Tar LZip (extension: .tlz), Tar XZ (extension: .txz) or .Zip (extension: .zip). For restoring the list of supported formats is even longer.
You can download the latest ApplePi Baker version for macOS here.
It doesn’t require much of a manual, although Hans has left detailed instructions for the geeks among us.
When you launch the program, there are three columns:
In the first, you point to the (SD) disk that you want to use for backup or restore purpose. For backups, you use the second column to define where you want to save the backup image. For restoring, the third column is where you point to the image file that you want to restore.
The only thing that needs a little explaining is one option that you can select: “Enable Linux Partition Resize”. This is where you specify if you want your SD-card backup compressed or not.
Please note that the shrink/expand option will only work with a plain MBR partitioning scheme (not GUID) using normal partitions (not Extended Partitions).
My choice is to check this one as it will save a lot of disk space.
When you hover over each option, you will see tooltips coming up that explain what they do. I leave the other options as they are default-wise.
Some interesting tidbits from the author of ApplePi Baker
ApplePi Baker is clearly a labor of love, and graciously the author made it freely available to the community.
I asked Hans to share some of his thoughts that went into the latest release, and he was kind enough to do that. It provides some useful background information that you have to think about before launching into the development of such a tool.
This is what he said:
When I created the original ApplePi Baker (in 2014), there was nothing on the market for macOS that could provide me the functionality I looked for. WinDiskImager was available for Windows, even though it originally was not designed for this particular purpose – but it works.
Initially, ApplePi Baker was created just for myself, but after more than 500,000 downloads, I would think a lot of people use it as well. I like programming as a hobby, and this one just went a little out of control.
I am proud and pleased though, to see though that so many people seem to use it.
With ApplePi Baker v2.x I’ve completely rebuilt the tool adhering to Apple’s security rules and API’s – which was quite a challenge.
Another change (versus v1) is that I’ve started to use a Linux compression library (https://www.libarchive.org/) to support more compression formats. With that came improved stability for compressed images, as command-line tools like zip and 7zip proved problematic over time (which is what I used in ApplePi Baker v1). For example, “zip” that comes with macOS had a few issues on older macOS versions.
One of the strengths of ApplePi Baker compared to the other tools is the option to shrink and expand partitions.
The complexity originates from SD cards not consistently being the same size, even from if they are the same brand and model, and occasional users (and myself as well) would run into an issue where restoring a backup to another SD card simply wouldn’t fit – as the target SD card was several bytes (!) smaller.
So… yet another challenge, as I had to educate myself on partitions and partition tables. Besides I had to figure out how to resize partitions.
For resizing the filesystem on a partition, I used yet another Linux tool “e2fsck” (http://e2fsprogs.sourceforge.net/). The main reason for that is that ApplePi Baker v2 resizes Linux partitions (Ext2/3/4, on a Linux partition with MBR partition tables). Still, before being able to resize a partition, one needs to resize the filesystem as well, and macOS does not support Ext2/3/4 natively.
Of course, the GUI of the old ApplePi Baker v1 looked very outdated, and with v2, I hope I did a good job of improving on that as well.
Additional changes include 64bit, signing the application, and notarizing the distribution DMG with Apple.
Thank you, Hans, for all your great work and I hope I have encouraged some of the Raspberry Pi home brewers working with Macs to give ApplePi Baker a try.
It works great and you can download it for free!
If you have any comments, let me know what you think.
- A step-by-step guide on how to back up the SD-card of your Raspberry Pi while it’s running
- Check the wifi signal strength of your Raspberry Pi digital picture frame before you hang it up on the wall
- How to automatically remove duplicate images from your Raspberry Pi digital frame photo library
- How to make sure that you can always connect to your Raspberry Pi picture frame even if your WiFi connection doesn’t work anymore