Last week I detailed how to set up Time Machine backups to a networked Windows computer that required a lot of somewhat complicated Terminal work. Here's a much easier shell script that'll do the trick nicely.
User sunkid at the InsanelyMac forums put together a shell script that, when run, automates all the steps I detailed in the previous post. A couple of the steps from my previous guide remain the same, so I'll include those steps as-is below. Starting at step three, you'll notice some changes. Here's how it all works:
Step One: Create a Shared Folder on Your Windows Network and Connect to It from Your Mac
One nice thing about offloading your Time Machine backups to your Windows computer is that it doesn't need a dedicated drive at all; you just need a folder that you can mount from your Mac.
First, make sure you have sharing turned on your Windows machine (search "advanced sharing settings" in the Windows Start menu), and make sure the folder you want to use as your backup is shared. On my Windows computer, the shared folder is at E:\Time Machine
.
Once it's created, you need to mount the folder from your Mac. To do this, open Finder, type Cmd+K, and enter the smb://
address to your Windows shared folder. On my system, that address looks like this:
smb://Windows/Media/TimeMachine
Windows is the name of my Windows machine on the network, Media is the name of the E:\ drive, and Time Machine is, of course, the name of my folder. You'll need to enter in your username and password for your Windows machine; make sure you save those to your keychain.
Step Two: Enable Backing Up Time Machine to Unsupported Network Volumes
By default, Time Machine won't write backups to just any network volume. (It prefers you buy a Time Capsule from Apple, I suppose.) Luckily this is easy to get around. You can either fire up Terminal (/Applications/Utilities/Terminal.app), paste the following command and hit Enter:
defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1
...or, if you've installed the very cool Secrets preference pane, you can just fire it up, find the Time Machine section, and tick the checkbox next to Show unsupported network volumes in Time Machine.
Step Three: Download and Run the Time Machine Shell Script
In the previous guide, this step required a bit of Terminal kung fu. Now all you have to do is download this shell script (read more about it at InsanelyMac), open Terminal, cd
to the folder containing the makeImage.sh
script, and then run the following command:
./makeImage.sh 130 /Volumes/TimeMachine/
Be sure to replace 130 with the size you'd prefer your Time Machine backup to be, and replace /Volumes/TimeMachine/
with the path to the mounted Windows volume you set up above. (Assuming you mounted that Windows share, you can simply type /Volumes/
and press Tab twice to see the mounted volumes on your machine. You should see your mounted Windows folder there.)
Step Four: Backup
If you were able to successfully run the script above, now all you should need to do is open up the Time Machine Preferences, turn Time Machine on, click the Select Backup Disk button, select the mounted Windows Time Machine folder, and click Use for Backup.
As before, whenever Time Machine runs its backups, it'll look for and automatically mount your Windows share, run the backup, and disconnect from the share. If you aren't on your home network, the backup will simply delay until you are.
Some notes: Reader varun suggests that Windows users may need to expand the size of the sparse span files, which would require making this small tweak to the hdiuitil command in the shell script. This method also adds an XML file to the backup as suggested by reader lee.lawmaster.
[Guide] 10.6 (Snow Leopard) Time Machine backup to network share [InsanelyMac]