Sideways Hacking Time Machine to Work with SMB (Windows) and Potentially Other Shares

| 2 Comments | 0 TrackBacks

I have a NAS with four 400GB harddrives running a RAID 5 installation, which means I won't lose data on there unless two of the drives go bad. It's done through my TS-409 (shown to the right). Since I have all these space, I might as well use it to backup my MacBook regularly so I don't lose any of my important data. OS X users know, Time Machine is awesome. It helps you take hourly, daily, and weekly snapshots of your computer. But unfortunately, it only works with additional harddrives attached to the machine, OR Time Capsule on your network... right? Wrong. Today, we will sideways hack Time Machine, and make it work with your SMB (Windows) share folder.

Before you get started, counter intuitive as it may seem, please be sure to have your data backed up before proceeding. While the memo is written with the best of intentions to help people make backups, I will not be responsible for any data loss as result of you following through this memo of my. You have been warned.

Now then, let's move on.

If you head straight over to System Preferences -> Time Machine, you will notice that it does not allow you to select your SMB based share. This is probably because Apple wants you to buy Time Capsule / external hard drives, or it could be because hdiutil doesn't work too well with SMB based share. Either ways, we'll hack it to work with our SMB share.

First, head over to the terminal; typically Applications -> Utilities -> Terminal, or if you're like me, QuickSilver -> iTerm. Once you have your terminal launched, issue this command:

Terminal Command
defaults write TMShowUnsupportedNetworkVolumes 1

It's pretty long, and it might've gotten squeeshed here, but that's all in one line. What that does is that it modifies a hidden configuration setting set by Apple, for the System Preferences application, to get Time Machine to show unsupported network drives. Guess what's unsupported? Yep, you guessed it, SMB / Windows share drives. Now that if you have it enabled, you will see your drive as an option to back up to... but you're not done yet! As this alone will not work -- remember what I said about hdiutils?

The next step gets a little bit more complicated, so please read carefully and look at the screenshots I am attaching. What you'd need to do now is figure out what is your ethernet's MAC address. Go back to your terminal (if you've left it already) and enter this command:

Terminal Command
ifconfig en0 | grep ether

You should get something like this as result:

Terminal Result
chiisana-osx:~ Andy$ ifconfig en0 | grep ether
ether 00:23:df:90:5f:e8

Copy down the series of hexadecimal numbers without the colons; in my example, it would be: "0023df905fe8". You will need this number later, so don't lose it.

Next, head over to System Preferences -> Sharing, and look near your computer name. While your computer name can be anything (I, for example, have it in Japanese), the identifier on networks MUST BE alphanumeric, and some basic symbols. This is typically deduced from your computer name's ascii parts. Take a look at this screenshot:


Notice my says "chiisana-osx.local"? You want to note down the part before .local. So for my example, it'd be "chiisana-osx". Write yours down, and don't lose it, you'll need this later too.

Finally, ask yourself the question: "How big is my harddrive?" If you don't know this information, go to your desktop, select "Macintosh HD", and click "Command + I". In the new window, it should tell you your harddrive's capacity. Note down that number, and give or take double it, because you'll need some extra space to keep historical copies in the Time Machine. Now we have all the information we'd need.

Go to System Preferences -> Time Machine, and setup your Time Machine on your desired network drive. Please keep in mind that Time Machine will create the backup file at the root of that network share, so if you want it in a specific folder, make sure you adjust your share accordingly before mounting. It should get started creating the backup... but after a while, it will fail (oh no!)... because hdiutil doesn't really work with SMB shares. Now what? Now we create our own backup file... Your backup file should be named machine identifier, underscore, MAC address, dot, sparsebundle. In my example, it would be "chiisana-osx_0023df905fe8.sparsebundle", make sure you make your own backup file name correctly, or Time Machine will not work. Once you have your backup file name constructed, go back to the terminal and issue this command:

Terminal Command
hdiutil create -size xxxg -fs HFS+J -volname "My Time Machine Backup" yyyyyyyy_zzzzzzzz.sparsebundle

Replace xxxg with numbers of GB you would like to allocate for backup; IE: 200g for 200GB, 300g for 300GB, 1T for 1TB, etc.

Replace yyyyyyyy_zzzzzzzz.sparesbundle with your backup file name; IE: chiisana-osx_0023df905fe8.sparsebundle

The first line, cd, will set you to your home directory, regardless of where you are. The second line will create the backup sparsebundle for you. In my case, the 200G sparse bundle worked out to be around 115M, but your sizes may vary. Once you have this file, move it to your SMB share, and set your Time Machine to backup again. This time, Time Machine will magically work! But because you're copying your entire harddrive's contents (in my case, upwards to 100GB), the first time making the backup will take some time... After it is done once, it will be much more snappy in the future. Happy time traveling!

No TrackBacks

TrackBack URL:


Thanks for figuring this out and sharing it Andy!

My daughter's Macbook HD crashed after 2 years, and of course no backups. My network is all Windows, except for her Macbook. I used your technique to set her up a backup on one of my servers.

So far, so good :-)

Glad I could help, if you notice any hiccups or have any suggestions, please do feel free to post back and let me know :)

Leave a comment

About this Entry

This page contains a single entry by Andy Huang published on June 18, 2009 10:50 PM.

Fiio E5 Review was the previous entry in this blog.

Unlock iPhone OS 3.0 With Push Support and no Rapid Battery Drain is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.