Posted on 07-06-2018 07:24 AM
I have a Mac Mini in my office that I've started testing for use as a Time Machine server. My goal is to be able to push a script to machines we know we're going to be reimaging soon so we can get them backed up before they get here. These backups can be quite large, so I've also set it to push out some exclusions of things we don't need backed up like Applications as a way to trim things down to just the users we care about. I've attached the relevant chunk of my script for that below.
The backup step seems to work flawlessly. It always immediately starts backing up the requested folders without issues. More importantly, it does so silently.
The problem is that I can't get it to restore from that backup. It just sits at "Loading Backup" and never makes progress. My testing environment has both the Mac Mini and the test machines hardwired. I'm thinking I must be excluding some vital folder, and as a result the backup on the server can't be opened by Migration Assistant correctly. I'm not sure what folder I need to stop excluding. Anyone see anything that would cause this?
#!/bin/bash
# Exclude all System folders
echo "Excluding Applications, Library, and System folders."
tmutil addexclusion -p /Applications
tmutil addexclusion -p /Library
tmutil addexclusion -p /System
# Exclude any other users on the computer (Edit for your specifics)
echo "Excluding {{Removed because public posting}} accounts."
tmutil addexclusion -p /Users/{{Removed because public posting}}
tmutil addexclusion -p /Users/{{Removed because public posting}}
tmutil addexclusion -p /Users/Shared
# Exclude Box, Dropbox, Google Drive, and OneDrive since they should back up to the cloud
echo "Excluding Box, Dropbox, Google Drive, and OneDrive."
tmutil addexclusion -p /Users/*/Box Sync
tmutil addexclusion -p /Users/*/Google Drive
tmutil addexclusion -p /Users/*/Dropbox
tmutil addexclusion -p /Users/*/OneDrive
# Exclude Trash for all users
echo "Excluding Trash."
tmutil addexclusion -p /Users/*/.Trash
# Exclude hidden root os folders
echo "Excluding hidden folders."
tmutil addexclusion -p /bin
tmutil addexclusion -p /cores
tmutil addexclusion -p /etc
tmutil addexclusion -p /Network
tmutil addexclusion -p /private
tmutil addexclusion -p /sbin
tmutil addexclusion -p /tmp
tmutil addexclusion -p /usr
tmutil addexclusion -p /var
tmutil addexclusion -p /opt
# Enable timemachine to start auto backing up
echo "Enabling Time Machine backup."
tmutil enable
# Start a back up immediately
echo "Starting first backup."
tmutil startbackup
exit 0
Posted on 07-16-2018 07:02 AM
@McAwesome I believe this would not be a restorable backup as Time Machine wants to restore the entire computer and not just the user. You may want to reimage a machine then either use migration assistant pulling the user data over from the backup or create another script that imports the user and applies correct permissions, or just drag the user folder back to /Users and apply permissions. (We use mobile AD accounts so for permissions ours would look like):
chown -R username:"domain users" /Users/username
Gabe Shackney
Princeton Public Schools