Wednesday, August 17, 2022

Nightly Time Machine

Jack Wellborn (tweet):

Nightly Time Machine is a collection of bash scripts that limits macOS’s Time Machine to once per night by only mounting Time Machine disks just before backing up and then unmounting them when Time Machine is finished. Preventing Time Machine disks from automatically mounting when connected also ensures they can be safely disconnected throughout the day.

[…]

At its best, Time Machine is “set it and forget it” in that you should never really have to think about it until a backup is needed or a backup disk needs to be replaced. Time Machine by itself is only at its best on desktops. On laptops, where external drives are frequently disconnected, Time Machine becomes a hassle at best and a risk to data at worst. With Nightly Time Machine, Time Machine is “set it and forget it” on laptops.

Earlier this year, I tried solving these problems using network Time Machine, but I gave up with that for my main Mac. I noticed that the Time Machine volume was mounted all off the time, and there was constant network traffic, seemingly because Spotlight was never able to catch up.

For my laptop that mostly acts as a desktop, I actually want the opposite functionality. Frequent backups during the day are good, but I want it to be quiet at night.

Previously:

9 Comments RSS · Twitter

Still running OS X, but I've long had a set up with two Time Machine disks and two disks for SuperDuper cloning. I only (think I) need once-daily TM backups and cloning. I alternate days—TM 1 and Clone 1 on one day, TM2 and Clone 2 the next, etc.— using Keyboard Maestro to schedule mounting/unmounting of disks. I have Keyboard Maestro initiate disk mounting and the Time Machine process, and SuperDuper handles cloning with its built-in scheduling. Afterward, Keyboard Maestro unmounts the disks.

I solved this (only backing up during the night) by scheduling these commands:
sudo /usr/bin/tmutil enable

and
sudo /usr/bin/tmutil disable

using keyboard maestro (or your other favourite tool to schedule shell commands.

I solved this (only backing up during the night) by scheduling these commands:
sudo /usr/bin/tmutil enable

and
sudo /usr/bin/tmutil disable

using keyboard maestro (or your other favourite tool to schedule shell commands.

Why not just schedule a `tmutil startbackup —auto` to run daily? And turn off auto backups.

These are good tips. In my case, it’s not just a matter of doing the backup at the right time. I also want to unmount the drive when it’s done because otherwise Spotlight will run all night.

Speaking of tmutil, it does have an option to run synchronously… so unmount could be next command in a script. Personally though I’ve not had issues with unmounting - seems like it’s happening automatically for me. I backup to a NAS.

>I noticed that the Time Machine volume was mounted all off the time, and there was constant network traffic, seemingly because Spotlight was never able to catch up.

Same. My Synology barely manages to catch a break. I _presume_ it's Spotlight (it's not Time Machine, at least according to the UI).

> I noticed that the Time Machine volume was mounted all off the time, and there was constant network traffic, seemingly because Spotlight was never able to catch up.

Don’t you have your TM volumes excluded from Spotlight? If not, curious to know why.

@Calum With APFS, there is no way to exclude Time Machine volumes from Spotlight.

Leave a Comment