Back Up Your Mac to Multiple Disks with Time Machine

Since the release of Time Machine, backing your Mac up has never been easier. If you want to back up different sets of files to more than one drive, though, this script will help you do so.

Time Machine, in typical Apple fashion, will seamlessly back up your data with little effort on your part. However, when it comes to doing something a little more advanced, Time Machine isn’t quite wired to do so. It can back up to multiple disks, for instance, but you’d have to change the preferences every time, which can be a pain. Thus, if you want to, say, back up your whole disk to one drive and only one subset of files onto other drive, you’ll need to automate it yourself.



To start, open up Time Machine and configure it to back up to your first drive with your desired preferences. After it goes through the first backup, head into /Library/Preferences and rename the com.apple.TimeMachine.plist file to com.apple.TimeMachine.Disk1.plist (or whatever other name you want to call it instead of “Disk1”). Go back into Time Machine, plug in your second drive, set the preferences for it, and let it back up too. If you go back to /Library/Preferences, the com.app.TimeMachine.plist will have reappeared, and you can rename it to com.apple.TimeMachine.Disk2.plist.

Next, open up Applescript Editor and paste this template into the box:


property pth : "Macintosh HD:Library:Preferences:"
property d1name : "Backup Disk 1"
property d1 : "com.apple.TimeMachine.Disk1.plist"
property d2name : "Backup Disk 2"
property d2 : "com.apple.TimeMachine.Disk2.plist"
property active : "com.apple.TimeMachine.plist"

do shell script "defaults write com.apple.TimeMachine AutoBackup -bool false"

if (list disks) contains d1name then
tell application "Finder" to if exists (pth & d1) then
set name of file (pth & active) to d2
set name of file (pth & d1) to active
end if
else if (list disks) contains d2name then
tell application "Finder" to if exists (pth & d2) then
set name of file (pth & active) to d1
set name of file (pth & d2) to active
end if
end if

do shell script "defaults write com.apple.TimeMachine AutoBackup -bool true"

Edit the “property” tags in the script above to correspond to your drives. pth will need to be set to the path to your preferences folder (unless you’ve actively moved it, you won’t need to edit this one); d1name will need to be set to the volume name of your first backup disk; d1 will need to be set to the term you added to the end of the plist file’s filename; and d2name and d2 will need to be set up like d1name and d1. Save the Applescript as a Script Bundle or an Application, whichever you prefer.

Time Machine can still only back up to one disk at a time, so the best way to do it is plug in the disk you want to back up and run the script. It will then automatically back up to that disk for as long as it’s plugged in. When you want to back up your second disk, just eject the first one, plug in the second one, and run the script again. Time Machine will then back up to the second disk with those preferences until you disconnect it. It’s not as perfect as being able to back up to both without fiddling with them, but it’s still a heck of a lot easier than manually moving preference files around yourself (or resetting the preferences every time you want to back up a new disk).





Published by Ashish

Hello friends, I am Ashish Barad, a tech lover student of MCA 2nd year from Nagpur, India.

Leave a comment

Your email address will not be published. Required fields are marked *

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.