Backing up a Raspberry Pi to a File Transporter

I love the Magpi Magazine for Raspberry Pi owners. It has the feel of the old computer magazines from the 80s when I was a kid. In the last two issues there is a two part series on backing up your Raspberry Pi by Norman Dunbar. You can get the magazine for free though I encourage you to buy a subscription if you like it to support their efforts. You can start with the first part on page 12 of Issue #9 for Feb 2013. I will touch on the basics below but leave the details for Norman’s articles.

In my case having just made the mount over to the transporter worked out great. Let’s walk through the steps of making the image backup to the transporter folder. That will not only give you a backup but an offsite one too as the transporter syncs it off to another location.

Determine the device name of the sd card

First we need to get the device name of the sd memory card our Raspberry Pi is running on. Log into the Pi and run the following command.

We can see that the partitions on the card start with “mmcblk0” and that is the part we need.

Run the backup to our mounted transporter drive

The backup will take a while to write especiallly if you have an 8GB or more card. You will not get a progress indicator. You will know it is done when you see records output lines.

Confirm the backup is over on the transporter

That is all there is to it. You have an image backup of your active sd card running your Raspberry Pi.
Check out Norman’s two part series on all the other neat tricks such as mounting the image to pull out files.

Mozy (on out of here) Backup for Mac

A long time back I had tested the online backup service Mozy.  By long time back I mean my version was mozy-0_6_2_6-502.dmg.  Today I was trouble shooting an application I am beta testing for someone.  I needed console logs.  Low and behold the Mozy removal script from that version was so bad it had left something behind.  I have TONS of the following events showing in my Console.

8/6/08 9:15:53 PM[1] (com.mozy.backup[1457]) posix_spawnp(“/Applications/”, …): No such file or directory 

8/6/08 9:15:53 PM[1] (com.mozy.backup[1457]) Exited with exit code: 1 

Well a bit of googling and I find that this combination works to finally get rid of that sucker.

sudo launchctl unload /Library/LaunchDaemons/com.mozy.backup.plist

Follow that up with going into the /Library/LaunchDaemons and tossing the file com.mozy.backup.plist into the trash.  Now I have nice clean console logs for troubleshooting a real problem.  Not something sucking up CPU cycles trying to relaunch every 10 seconds.

Laptop Backup via Rsync + iPod

My previous post talked about using rsync to backup securely to another computer over the Internet. What if you want a local spare backup or do not have Internet?

Here is what I did on my mac powerbook.

Set your iPod so you can use it as a removable drive. iPod has to be set to “Enable Disc Use”.

Create an Encrypted Sparse Disc Image on the iPod. You can just follow the directions over on

hdiutil create -size 5g -encryption -type SPARSE -fs HFS+ Backup

That creates an encrypted sparse image file named Backup that maxes out at 5GB. We open the image once, and rename the Drive name label to EncryptBackup. That will be what shows if we look at the mounted volumes.

Now all you have to do is use a nice rsync command to backup your documents into the mounted encrypted Spare Image.

rsync -avg –exclude “Documents/browseback/” ~/Documents /Volumes/EncryptBackup

That will sync our Documents folder over into the Encrypted Backup image file on the iPod just as if it were its own drive. Note the –exclude option. I have a program called BrowseBack for the Mac. It caches copies of everything I browse there so I can find previous content again via web, send to pdf, email etc. But I don’t want to backup all that cached data.


Modified the script I have on my iPod to mount, backup then dismount the image.

hdiutil attach /Volumes/iPod/Backup/Backup.sparseimage
rsync -avg –exclude “Documents/browseback/” ~/Documents /Volumes/EncryptBackup
hdiutil detach /Volumes/EncryptBackup

Then an Automator saved as an application onto the iPod and its an easy double click. If you save your image’s password in your keychain you won’t have to enter that either.

Laptop Backup via Rsync + SSH

I was playing around with rsync the other night. Now I have a scripted command so I can backup folders from my laptop back to the external harddrive on my iMac at home. You can find the command below.

We need to assume you have done several a couple of things to improve the security of your SSH at home.

  1. Moved from the standard tcp 22 port to a new port: example 5346
  2. Turned off password authentication in favor of public-private key authentication.
  3. Have your ssh private key saved somewhere on your laptop simple like the default ~/.ssh folder. The default keyname is id_rsa if you generated your key with a command like
    ssh-keygen -t rsa
  4. The folder we want to backup is called Documents just in our home folder on our Apple Powerbook.
  5. We will assume you registered a Dyndns name for you home machine.: example
  6. The username on your home iMac or *nix box is: username
  7. The external drive is called: ExternalDrive

Here is the command you would issue on your Mac or *nix laptop. It should all be on one line. The best part is that it will take a while depending on how much stuff you have in your Documents folder. After that it will only sync over the changes. Perfect when away from home and you want a backup safely off your laptop.

rsync -avrz -e “ssh -p 5346 -i .ssh/id_rsa” Documents