How To Set Up Time Machine To Back Up To A Networked Windows Or Linux Computer

I've got a Mac laptop and a Windows desktop, and my Windows desktop has a mighty large hard drive begging to be used for my Time Machine backups. Here's how to set it up.

Note: I owe most of the important steps for this process (the Terminal commands) to this blog post from 2008.

This process should work on Linux, as well, but I'll focus on the Windows side of the coin.

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 on your Windows machine, and make sure the folder you want to use 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 but 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: Create Your Dummy Backup File

Just to make sure everything's working as it should to this point, open Time Machine in your System Preferences and click the Select Backup Disk button. If you've mounted your Windows Time Machine folder, it should now show up in the list of potential backup disks. Select it, and click Use for Backup.

Now try backing up to your Windows machine (select Back Up Now from Time Machine in your menu bar). If the backup fails at this point, don't worry — we're expecting that. You need to create a backup file (it's a sparse bundle) first, which will require a little more Terminal work. So fire up Terminal, and paste the following line with a few edits customised to your setup:

hdiutil create -size 125g -fs HFS+J -volname "TimeMachine" ComputerName_MACADDRESS.sparsebundle NOTE: Don't paste that without editing it.

The first thing you want to customise is the number 125g — that's 125GB, which is my preferred size for my Time Machine backup. Pick your preferred Time Machine backup size.

Next, you can customise the text after -volname to whatever you want. I've called it TimeMachine.

Last, you have to customise the sparsebundle name, which consists of your Mac's name (mine's Air), an underscore, and your Mac's MAC address (minus the colons). To get your computer's name, paste this command into Terminal:

scutil —get ComputerName

To get your MAC address, paste the following into Terminal:

ifconfig en0 | grep ether

Strip all the colons from the MAC address, add them to the end of your computer name (separated by an underscore), and then enter your customised command into Terminal. When it's done, you'll have a file (in your Home directory if that's where you're running the Terminal commands from) named ComputerName_MACADDRESS.sparsebundle.

You're almost done.

Step Four: Copy Your Time Machine Backup File to Your Windows Machine

Now you've just got to run one more Terminal command to finish up. Again, you'll want to customise this to fit your setup.

cp -R ComputerName_MACADDRESS.sparsebundle /Volumes/TimeMachine

The sparsebundle file should have the same name as the sparsebundle file you created above, and the Volume name should be whatever you mounted your shared Windows folder as (remember, mine's called TimeMachine, so it's Volumes/TimeMachine.

Once you've customised that command, enter it into Terminal and hit Enter. It will likely take a few minutes for the file to continue copying to your Windows machine, but once it has, you're ready to back up! Select Back Up Now from the Time Machine drop-down in your menu bar, and if the setup went as planned, your machine should successfully make its first Time Machine backup over your network and to your Windows machine.

Now 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.

I've only been backing up Time Machine to my Windows computer for a short while now, but so far it's working great. If you've done the same, let's hear how it's working for you in the comments.



Comments

    Also worth noting is that you can change the time machine backup interval if you think it's too frequent. For my system, I thought every two hours was a little too frequent so I've bumped it up to every four using the following command:

    sudo defaults write /System/Library/LaunchDaemons/com.apple.backupd-auto StartInterval -int 14400

    The key number is the last one which denotes seconds between backups. So for four hours it's 60secs x 60 mins x 4 hours = 14,400 seconds.

    Remember that this process is completely unsupported by Apple - if it breaks, it'll probably break properly and there may be little help to unbreak it.

    There's a variety of feedback on the web about the fact that a backup to a sparsedisk also lacks full verify capability so there's no way to REALLY know the backup is working.

    Also, it's more difficult to do a full restore from a backup done like this than a more traditional TimeMachine backup to a supported disk.

    These are your backups you're talking about - is it REALLY worth these kinds of down-sides for something this important?

    Personally? No.

Join the discussion!

Trending Stories Right Now