Time Machine is certainly an easy-to-use app for backing up your data. It’s free, and comes installed and ready to use with the Mac OS. In many of our Rocket Yard guides, we’ve often suggested that you perform a backup before proceeding with the rest of the steps in the guide. Click on Time Machine icon in the menu bar and click on Back Up Now to start back up manually. If the automatic option is enabled, then the backup will start in one hour. You can always when the next backup will start from the Time Machine Preferences. Choosing between Automatic or Manual backups. If the Time Machine icon isn’t in the menu bar, choose Apple menu System Preferences, click Time Machine, then select “Show Time Machine in menu bar.” Open Time Machine preferences for me.
I just got a MacBook Pro running macOS Catalina for work, and I wanted to set up Time Machine backups for it to the Synology NAS in my basement so that if the laptop dies or is lost and I need to replace it, I won’t have to redo all of the customizations it took me hours to set up. (I’m separately backing up my data files using Backblaze, but Backblaze doesn’t back up system files and applications.)
I followed Synology’s instructions for using my NAS as a Time Machine backup target, but I couldn’t get the first, full backup to complete successfully after doing that. When Time Machine started to back up, it would say “Looking for backup disk” and then say “Preparing backup” and then stop one or two minutes later with no error message. Below, I explain what I investigating this problem, and how I ultimately solved it.
This article is probably applicable to other Macs (not just MacBook Pro) and other NAS servers (not just Synology).
How backing up to a network drive works
All of these steps need to complete for the first, full Time Machine backup to a network share to succeed:
- Mount the share. If you run the “mount” command in a Terminal window or open Disk Utility you will see it mounted.
- Create a “sparse bundle” on the network share to hold the backup. Basically, this is a disk image stored on the network share that can be mounted as a separate filesystem. Initially the sparse bundle is created with a random name (I think), but after it’s successfully created it’s renamed to contain the host name of the computer being backed up.
- Unmount the network share and mount the sparse bundle directly.
- Write all the backup data to the mounted sparse bundle.
- Unmount the sparse bundle.
What was going wrong
TL;DR It’s the WiFi, dammit.
I kept running the backup. It kept failing part of the way through step 2, i.e., creating the sparse bundle. I know this because I was watching the file share in which the sparse bundle is stored, and each time the backup ran it deleted and recreated the sparse bundle from scratch, and each time it exited prematurely the sparse bundle was a different size.
Eventually Time Machine did manage to successfully create and rename the sparse bundle, but then after that it once again stopped prematurely a couple of minutes into writing the backup data. Each time I restarted the backup it would write a little more data and then stop prematurely.
Seo checker 1 5 – seo checker grammar. To diagnose this further, I ran a
ping
command in a Terminal window while the backup was running, pinging the NAS. Here’s what I saw immediately before the backup failed:One of two things was happening: either the NAS was briefly becoming inaccessible to my Mac in the middle of the backup, or my Mac was briefly losing network connectivity in the middle of the backup. To determine which of these was the case, I ran the backup again, but this time rather than pinging the NAS during the backup, I pinged another machine on the network. I saw the same brief interruption, which proved that it was the Mac, not the NAS, that’s losing network connectivity briefly during the backup.
This is not surprising, since if you spend some time Googling, you will discover that there are a lot of complaints online about Macs intermittently dropping their WiFi connections briefly. No one really has a good explanation for why this happens or how to fix it. It appears that this is just a widespread problem in Mac WiFi support that Apple hasn’t prioritized fixing.
Unfortunately, the AFP over TCP network filesystem protocol code in the Mac kernel is apparently extremely sensitive to brief interruptions in network connectivity and incapable of recovering from brief network connections. Therefore, every time this WiFi blip happens, Time Machine gets back a filesystem error from the kernel and aborts the backup.
How I fixed it
At a high level, here’s what I did to fix this:
- Mount the network file share with a “hard mount” so that brief network interruptions won’t cause Time Machine to freak out.
- Create a sparse bundle manually on the mounted network file share rather than letting Time Machine do it.
- Mount the sparse bundle.
- Tell Time Machine to use the sparse bundle as its backup location.
- Set up a launch agent task to mount the network file share and sparse bundle automatically every time I log in.
Hard-mounting the network file share
The key here is the
-k
argument to mount_afp
, which is what specifies a hard mount.How To Schedule Time Machine Backups
Creating the sparse bundle
- Open Disk Utility.
- Select File | New Image | Blank Image…
- Open the folder
~/Mountpoints/TimeMachineBackups
or wherever you mounted the network file share. - Enter the name you want to save the bundle as in the “Save as” and “Name” fields.
- Change the “Image Format” field to “sparse bundle disk image”.
- Change the “Size” field to the size of your hard disk.
- Click “Save”.
Mount the sparse bundle
Disk Utility will mount the sparse bundle automatically after you create it. Click the eject button in Disk Utility to eject it, and then do something like this:
If the mounted filesystem shows up on your Desktop and you don’t want it there, you can make it disappear like this:
Tell Time Machine where to back up
You may need to grant Terminal full disk access to run this command. If so, you’ll see an error message in your Terminal telling you that with instructions for how to do it. I recommend turning off full disk access for terminal after it’s done!
Finally, open Time Machine preferences, enable “Back Up Automatically”, enable “SHow Time Machine in menu bar”, click on Time Machine in the menu bar, select “Back Up Now”, and watch the preferences window to make sure everything is working.
Apple Time Machine Full Backup
Mounting everything automatically using a launch agent
I created this script as
~/scripts/mount_time_machine_backup.sh
(I’ve obscured some sensitive details here):I made the script mode 0700 so I wasn’t exposing my network file share password to the world.
Then I put this in
~/Library/LaunchAgents/comp.jik.TimeMachineMounts.plist
:Then
launchctl load ~/Library/LaunchAgents/comp.jik.TimeMachineMounts.plist
, and we’re done!Warnings
My MacBook has crashed at least twice in less than a week since I set this up as described above. Judging from the stack trace that displays after reboot, it looks to me like it’s crashing inside network filesystem code. In addition, each time it has crashed, Time Machine has popped up a message telling me my backup was corrupt and needed to be recreated from scratch. So while the process described above works, it cannot be said to work perfectly, apparently, because of a kernel bug in macOS.
![How To Backup With Time Machine How To Backup With Time Machine](https://upload.wikimedia.org/wikipedia/commons/thumb/9/91/-1-_Time_Machine_Backups%2C_1%2C_29_images%2C_DSC0082_-_DSC0110_-_15670x2583_-_SCUL-Smartblend-2.jpg/1200px--1-_Time_Machine_Backups%2C_1%2C_29_images%2C_DSC0082_-_DSC0110_-_15670x2583_-_SCUL-Smartblend-2.jpg)
Credits
The following pages written by other people were helpful to me in figuring out much of this, though none of them put all the pieces together quite like I have here:
- Creating a sparse bundle, and telling Time Machine to use it using
tmutil setdestination
: https://kb.lsa.umich.edu/public/index.php/Backing_up_with_Time_Machine_to_network_storage_using_a_sparse_bundle - Running a script on login: https://stackoverflow.com/questions/6442364/running-script-upon-login-mac/13372744#13372744
- Mounting a sparse bundle from the command line: https://apple.stackexchange.com/a/23523
- Preventing a mounted filesystem from showing up on the Desktop: https://www.idownloadblog.com/2016/12/02/how-to-hide-mounted-volumes-from-desktop-finder/
(Mac OS X 10.6.x+)
By default, Time Machine can run an automatic backup every hour. Gpg suite 2019 2 download free. This valuecan be changed by following this tutorial.
By default, Time Machine can run an automatic backup every hour. Gpg suite 2019 2 download free. This valuecan be changed by following this tutorial.
Option 1: Manually Edit the Time Machine Preference File
Note: this is a more technical procedure, for those who will need to changethe frequency on a regular basis, or those who would like a more user-friendlymethod of editing this value, please see Option 2.
- The one-hour default is actually a «magic number» stored in a preferencefile; the default value of 3600 represents the number of seconds betweenbackups.
- The file we need to edit is located under
/System/Library/LaunchDaemons
- Open
com.apple.backupd-auto.plist
with a text editor on your machine(e.g., TextEdit) and find the following in the file: - As mentioned, the default value is 3600, representing 3600 seconds = 1 hour.Here are some other second values that could be used:
Desired Frequency Seconds Once an hour 3600 Once every 2 hours 7200 Once every 6 hours 21600 Twice a day (12 Hours) 43200 Once per day 86400 - Recommended interval:
- For laptop users, the default (once per hour) will work fine.
- For desktop users, twice per day.
- Recommended interval:
- Replace the
3600
with the desired frequency value and save the file. Asthis file is a protected system file, you will be required to enter yourpassword to save the file.
- Note: If you receive a message that you cannot save the file, try using adifferent text editor, as some will prompt for a system password and otherwill return an error message when writing over protected files. You canalso change the permissions using
chmod
before editing, to enable writingto the file:>cd /System/Library/LaunchDaemons
>chmod u+w com.apple.backupd-auto.plist
… edit the file … save the file …>chmod u-w com.apple.backupd-auto.plist
If you receive a permissions error, you can usesudo chmod
instead ofchmod
in the above script to invoke super user permissions.
- You’re Time Machine will now perform the automatic backup at the intervalspecified. This second-timer will start counting down from the time at whichthe system is turned on.
Option 2: TimeMachineEditor
How To Do A Backup With Time Machine
TimeMachineEditor is a GUI-based software that allows the customization of howfrequently Time Machine will backup. If you do not feel comfortable manuallychanging the frequency (or have a need to change the value quite often), thismay be a more appealing option
How To Back Up With Time Machine
- Go to the homepage for TimeMachineEditor
- Download the latest version of TimeMachineEditor
- Follow the installation instructions
Override Time Machine
Back Up With Time Machine
- Go to System Preferences and open the Time Machine settings
- Turn OFF automatic backups
- Reboot your machine to ensure these changes are applied
- After rebooting, you can open TimeMachineEditor and schedule your backup ona basis of either frequency per day / week / month, OR at regularlyscheduled calendar intervals (e.g., every Sunday at 2:00 AM).
- Slide the switch at the bottom left of TimeMachineEditor to the «ON»position to enable TimeMachineEditor managed backups.
- Note: Under the Time Machine settings in System Preferences, leave theswitch for automatic backups in the «OFF» postion