rSync when Time Machine fails

Posted on June 28, 2012

13


Butterflies are the cause of Time Machine Failures

The Butterfly Effect or why Time Machine is bound to FAIL

0 < d(x, y) < \delta  such that

d(f^\tau(x), f^\tau(y)) > \mathrm{e}^{a\tau} \, d(x,y).

Have you ever heard of the butterfly effect in regards to time travel?  Well despite your best intentions to go back in time to remedy something about your current situation you are usually doomed to failure because of butterflies.

So I will officially declare butterflies as the cause of my recent spat of Time Machine backup failures.  I’m destined to live in the present because the many months of successful Time Machine backups to my Synology have recently been tossed because Time Machine isn’t happy with butterflies.

Here’s the dreaded Time Machine FAIL message:

“Time Machine completed a verification of your backups. To improve reliability, Time Machine must create a new backup for you.” It goes on to say, “Click Start New Backup to create a new backup. This will remove your existing backup history. This could take several hours.”

Time Machine is out of order – Try Again…

So it is on that note that I have decided that we need 2 backup methods to our NAS.  I’ll still try to troubleshoot Time Machine, but the incessant write, toss and rewrite for the last 3 weeks (it takes several days to completely do a backup) is going to eventually wear out the drives!

Time Machine says 23 days for a backup? again??

What to use for backups?  I decided I need industrial strength, proven and reliable backup solutions that the big enterprise folks use.  Turns out it is free and already installed on both Synology and my Mac!

If your goal is to simply have a backup boot drive then you may want to look at Carbon Copy Cloner (free/donation) which uses rsync under the hood, but is a clean UI driven design for making bootable backups of your Mac.

rsync backup is built into both Macs and Synology

What is rsync? It is from the Unix open source code world and was an improvement over rcp (remote copy).  rsync introduced the idea of only copying the files that have changed, so future backups only copy the changed files.  rsync however does not easily archive multiple versions of a file like Time Machine does, or do them automatically.  I’ve seen some scripts for doing this, but it is over my head for now.

Well if you want to read the early gruesome history on the Mac you can read it here.  That said I think many of the issues have been resolved and it has been faster and more reliable than Time Machine for making sure my irreplaceable home movies and photos are backed up efficiently.

This post includes both the setup you need to do on the Synology side, and the Terminal actions you need to do on the Mac OS X side to initiate a rsync backup.

Setting up Synology to support rsync

Step 1: Log into the web interface of your Synology NAS.

You can use your Synology Assistant in your Mac’s Utilities folder if you are having problems connecting.  Once logged into your Disk Station manager via the web interface you can choose the 3 block icon in the upper left corner and access control panel.

Step 2: Go to your control panel and choose “Network Backup”

Select Network Backup on your Synology Disk Station’s control panel DSM 4

Step 4 – Check the option to “Enable network backup service”

Be sure to enable network backup service only

Do not turn on customized rsync configuration unless you are comfortable logging into your Synology via Telnet or SSH.  See Synology’s DSM help on network backup for more details to do advanced rsync features.

Do not use the other 2 tabs: Shared Folder Sync (used for keeping 2 Synology Disk Stations in sync) or Synology’s Time Backup (not to be confused with Apple’s Time Machine).  If someone is using Synology’s graphical Time Backup please feel free to comment.  For now I’ve only explored Apple Time Machine and rsync backups of my Macs to my Synology Disk Station NAS.

Click Apply and close the control panel.

Step 5: Create a folder location for your Mac’s rsync backups.

From DSM 4’s desktop choose the 3 block icon in the upper left corner and open File Station.

Choose File Station

Step 6: Create a new shared folder

Navigate to the volume and folder location you want your rsync backups to occur and choose the “create” button and select “Create New Shared Folder.”

Choose create new shared folder

Step 7: Fill in your shared folder’s details

The name of your folder can’t contain spaces.

Do not use encryption unless the data is super sensitive.  Encryption slows down backups and if you lose you key you can’t restore your data.

Step 8: Setup which users can access your new rsync folder.

Choose which users can access your rsync folder

Use the add button to add users.  It is a good idea to give different accounts to different computers.  That way you can track which specific macs are access the server (unlike if you use 1 master account for all computers) in the Synology access logs.

Once you click ok your shared folder will be setup and ready to access from your Mac’s finder.

Verify your shared folder has shown up and is accessible from your Mac’s finder.

Step 9 – Add Mac File Services so your Mac can access

If you’ve already setup Time Machine to sync with your Synology then you’ve already done this step.  If you can’t access your Synology NAS from the Mac finder then you need to add Mac File Services.

Go to DSM 4’s control panel and select “Win/Mac/NFS”

In your control panel select Win/Mac/NFS and enable Mac File Service

Click the apply button

Step 10 – Check to see if your Mac can access your rsync folder

Verify you can see the rsync folder on your Synology from the Mac’s Finder.

From the finder look for your Synology Disk Station listed in the left hand side bar.  Login with your user account info and verify you can read and write to your rsync backups folder.

When I tried to login and create a new folder in my rsync folder I got the error message: “The operation can’t be completed.  An unexpected error occurred (error code -8058)”  If anyone can streamline these steps let me know and I’ll update them.

In the screenshot above I came to find out that servers listed in the Finder as Shared would not always work well.  The Devices section was much more reliable (just click your user name to expand the list of connected servers).

If you are still struggling I did find that there are 10 ways to mount a server in this article that might be helpful.

error code -8058? So Now What?

If you run into this, then you should make sure your Synology is mounted correctly.  I was able to mount the folder correctly by using the Finder to connect to the server.  Here are the steps.

  1. Go to your Mac Finder
  2. From the Finder’s Menu Bar choose “Go” > “Connect to Server” or use the keyboard shortcut ⌘K
  3. Find the IP address for your Synology NAS unit.  You can use the recent or browse button or get the IP address from Synology assistant, or URL in web browser.
  4. Type in the server address as: “afp://” followed by the IP address (in my case afp://10.0.1.17)
  5. It should now show up in your Finder’s sidebar under devices.
  6. You can also turn on desktop icons for servers by going to Finder, choosing “Finder” in the menu bar and choosing “Finder Preferences.”  In the general tab choose to show connected servers on the desktop.

Steps to backup your Mac to your Synology using rsync:

Step 1: Launch Mac OS X Terminal Window

Go to your Utilities folder on your Mac and choose Terminal.

Using the Terminal on the Mac is a lot like DOS for Windows users.  It may feel archaic or even intimidating, but don’t let that stop you from discovering one of the best built in backup tools that Macs and Synology Disk Stations have built in for handling backups.

Step 2: Type: “rsync -av “

Make sure you have a space after the -av .  It should read, “rsync -av  ” (without the quotes, but with the space).

DO NOT HIT RETURN YET.  If you do you will get a screenful of text explaining how to use rsync and you’ll have to retype step 2.

details:  rsync -v tells rsync to show each item as it copies in verbose mode, rsync-a tells your mac that we want to archive the following content path (step 4) to the destination path (step 6) while preserving time/date info and folder permissions.  Together this makes rsync -av  Now we just need to add what we want copied, and where.

The Terminal allows command line control over your mac.  rsync is a built in utility that allows blazingly fast file transfers.  It is the standard in the UNIX world for transferring data.  The rsync command we are using is broken up into these 3 items: rsync [options] [target]

In the Terminal tell Mac OS X to run rsync in -archive and- verbose modes

Step 3: Open your Mac’s Finder window that shows the volume or folder of what you want to back up.

For now try a simple test of a folder full of sample files.  Later on it could be an entire disk drive.

Step 4: Drag the icon of the source volume or folder into the terminal window

Wait for a green circle + icon to show next to your mouse cursor and drop into the terminal window at the end of your rsync -av .  You should see the path name to your contents show in the terminal window appended to rsync -av

In my case it displays as: Stephen-Inoues-Mac-Pro:~ MacProHome$ rsync -av /Volumes/Media/Photos\ and\ Video

Step 5: Connect to the Synology shared folder you are doing the rsync to

Go to your Finder and from the Go menu choose Connect to Server and correctly mount the Synology shared folder you want to use.

Log onto your Synology NAS and bring the finder view of the location you want to back up to.  If you can’t see your backup volume you may need to follow the steps in my setting up Time Machine with Synology to configure it correctly.

Log into your NAS via the finder, and not the web interface

Step 6: Drag the icon of the destination into the terminal window

Goto the Mac OS X Finder and from your Finder’s sidebar look for your Devices and see if your user name has access to the Synology NAS.  Do not try to drag the Synology NAS from the list of shared items in the sidebar as that did not work for dropping a path name (no green circle with a plus).

You should get the same green circle with a plus icon in it when you go to drop the destination Synology folder into the Mac OS X Terminal window.

If you didn’t get the green circle with a + icon when you went to drop your dragged item then your Mac isn’t seeing the path to the server correctly.  You can manually type the path, or make sure you are dragging the server from the desktop or the finder’s device section (not the finder’s shared section like in my screenshots).

rsync is now ready for you to hit ENTER

My rsync backup of photos and videos now has this text: Stephen-Inoues-Mac-Pro:~ MacProHome$ rsync -av /Volumes/Media/Photos\ and\ Video /Volumes/rsync_backups

Step 7 – Hit RETURN in the Terminal Window

This is the fun part.  Hit the return key and watch rsync in action.

FAIL?

You might get a few fails at first.  Syntax is everything.  Watch for spaces,  / is a path,  \ is a space.

Try a simple local copy of a single folder of items on your Mac’s desktop (source) to a new empty folder on your desktop (destination).  If you get this working then try again with your Mac and Synology.

I have not figured out how to copy entire volumes without getting permission errors.  I’m sure it can be done, but for now I live with my fail and  just rsync folders.

Key things to remember:

rsync with the -a(archive) is CRITICAL to preserving your time/date stamp in your files, photos, etc.  If you don’t do this your backed up files will show a modified date of today instead of their original date (a really big deal if you discover this after the fact).

I’m not a rsync expert, but have turned to it because it I needed a safe, fast and reliable method for backing up important documents, photos and videos that Time Machine was not reliably doing.  If you have useful insights on how you use rsync to back up your Macs to your Synology NAS please share in the comments.

Doing a restore of a rsync backup was simply reversing the source and destination in the command line.  I wouldn’t do this for the boot disc (use carbon copy cloner instead) but for photos, videos and important documents it has worked well for me.

Some Useful Links I came across in researching rsync:

Advertisements