This article was first published more than 14 years ago
and was last updated in 2023.
The article is no longer being maintained and remains available for people visiting this page from external links.
Update
The problem described in this article is now being handled by macOS. In most cases, you are given the option to associate the Time Machine disk and inherit the backup history.
If you clone a volume that you backup with Time Machine, its UUID will change and Time Machine will no longer be able to make backups of it. However, it won’t tell you directly what the problem is. Rather, you will find entries like the following in /var/log/system.log:
1backupd Backup failed with error: 12
2backupd Error (12): Link of previous volume failed for macosx.
If you want to continue to backup to the same volume in your Time Machine backup database, the following script allows you to change the UUID of the existing backups, leading Time Machine to backup as if the volume’s UUID had never changed.
Usage Example
1./timemachine-setuuid.sh "Backup of MyMac""Macintosh HD" 2 3Using Time Machine volume
4"/Volumes/Backup of MyMac" 5with backup database located at
6"/Volumes/Backup of MyMac/Backups.backupdb/MyMac" 7 8UUID of volume "Macintosh HD" will be set to "394FBC68-AA00-3556-81B5-D61F5BFA27ED" 910Done
Example usage
Shell script timemachine-setuuid.sh
And here’s the script.
1#!/usr/bin/env bash
2set -u;set -e
3 4# From: http://www.macosxhints.com/article.php?story=20090213071015789 5# All credits go to the author "only_solutions ()". Their profile is at 6# http://www.macosxhints.com/users.php?mode=profile&uid=1060791 7 8if[[$# -ne 2]];then 9echo"Usage: `basename "$0"` `<Time Machine volume, e.g. \"Backup of My Mac\">` `<Disk whose UUID needs to be set, e.g. \"Macintosh HD\">`"10exit111fi1213errxit (){14[["$2"]]&&printf"$2\n" >&215exit${1:-1}16}1718say (){19msg="${1-`}"
20 [[ ! -z "$msg" ]] && printf "$msg\n" >&2
21}
2223# Check if Time Machine volume is mounted in /Volumes
24TMV="$(cd"/Volumes/$1"&&pwd)"
2526# Check if source volume is mounted in /Volumes
27SRCVOLUME="$(cd"/Volumes/$2"&&pwd)"
2829# Strip '/Volumes' to obtain source volume name
30VOLNAME="${SRCVOLUME#/Volumes/}"
3132# Get source volume UUID
33UUID="$( diskutil info "$SRCVOLUME"| sed -nE 's/.*Volume UUID: +([-A-F0-9]+).*/\1/p')"
3435# Get path to backup database
36BDB="$TMV/Backups.backupdb/$(scutil --get ComputerName)"
37if ! ls "$BDB" &>/dev/null; then
38 errxit 1 "Invalid backup database path:
39\"$BDB\""
40fi
4142if ! ls "$BDB/"*/"$VOLNAME" &>/dev/null; then
43 errxit 1 "Volume \"$VOLNAME\" not found in backup database at
44\"$BDB\""
45fi
4647say "Using Time Machine volume
48\"$TMV\"49with backup database located at
50\"$BDB\"5152UUID of volume \"$VOLNAME\" will be set to \"$UUID\"53"
5455# Disable ACL protection on Time Machine volume
56sudo fsaclctl -p "$TMV" -d
5758sudo xattr -w com.apple.backupd.SnapshotVolumeUUID "$UUID" \
59 "$BDB"/[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]-*/"$VOLNAME"
6061# Re-enable ACL protection on Time Machine volume
62sudo fsaclctl -p "$TMV" -e
6364echo "Done"
Shell script timemachine-setuuid.sh
Save the above code to a file called e.g. timemachine-setuuid.sh and make that file executable by issuing