Time Machine running on Snow Leopard, backup to Ubuntu 9.04, 9.10 Samba Share
Time Machine software seems to look for Time Capsules that you buy specifically for Time Machine backups. This is great for the consumer who just wants a backup solution without the hassle, but for some of us computer dorks, we already have drives running on who knows what, with gobs of storage, and already on our local network. Besides,... Time Capsules aren't cheap! While I'm still figuring out that my time is not cheap either, this is the approach I took to getting my Mac to backup with Time Machine to a Ubuntu 9.04 desktop.
Warning: This method is not support by Apple. As with anything on this site, it's your choice, your fingers, and your mistake should you choose to follow any of my guides and break something.
Drop to a terminal and run (I use a shortcut key combination of [Command]+[Space] to launch things, then start typing "Terminal" without quotes, and [Enter]):
defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1
The above command will get Time Machine to see unsupported network shares, which is everything except a Time Capsule.
I've spent entirely too much time avoiding spending the money for a Time Capsule, and that is quite possibly the reason why Apple may be getting away with proprietizing on its Time Capsule products.
Continuing on...
I'm not going into networking or how to setup the Ubuntu machine. I will tell you, however, that I downloaded the Ubuntu 9.04 Desktop 64bit version CDROM Image file (ISO), burned to CD, booted a desktop from it, and installed. After install, and getting into the desktop, I created a new folder on the desktop (right click, etc), and again right clicked on this newly created folder and clicked Sharing Options. Within the Sharing Options dialog, I checked Share this folder. On a fresh install of Ubuntu 9.04 Jaunty, this action will probably ask you to install some things like Samba, etc. If your Ubuntu has a network connection to the Internet, this goes pretty smoothly.
Back to the Mac:
There are two ways to create an Image that Time Machine can backup to the network share: Automated and Manual
Automated Time Machine Image Creation:
First get the network share seen by Time Machine. Open a Finder window and click "Go" Menu from the top and Connect to Server.
Under Server Address, type in "smb://" followed by the IP of the network share. Click Connect. If asked for a folder select the one you want for your backup.
Attached to this thread is a shell script file "makeImage.sh_.txt.sh". Save this to your Downloads.
In your terminal window, type:
cd ~/Downloads
Next decide how big you want your Time Machine Backup to be limited to in size. I chose 250G, half of my 500G running Ubuntu 9.04.
Next, you need to know the mounted location of your network share. If you're not sure what your share is mounted as, you can list the contents of the /Volumes folder like this:
ls /Volumes
Now the actual command to setup the size limit and copy the created image to the destination:
./makeImage.sh_.txt.sh 250 /Volumes/timemachine/
"/Volumes/timemachine/" is the mount I chose. Yours will be whatever you named it to on Ubuntu.
That should do it. If this didn't work, you can always continue with the Manual Time Machine Image Creation method below.
DONE
Manual Time Machine Image Creation:
You'll need to create a Time Machine Image and copy that image into the remote share, or else Time Machine will begin backing up and fail every time. Since the site I pulled an automated shell script from is not coming up at the moment, I'll list out the manual approach. Pull up a Terminal (on the MAC, not the Linux box) again and type out a command using the following guidelines:
sudo hdiutil create -size [size]g -type SPARSEBUNDLE -nospotlight -volname "[Volname]" -fs HFS+J -verbose ~/Desktop/[computer_name].sparsebundle
The above Mac command line needs your input. Here is an explanation of what the elements are that need your input:
[size] = Size in Gigabytes that the backup image can grow to. Obviously, the image size should be more than the Mac hard drive. In my case, my Mac drive is 160G. I chose 250G backup image size. The bigger, the more increments you'll have back in time to restore from.
[Volname] = Name of the backup image
[computer_name] = the verbose name of the computer. You can find the name of your Mac by clicking Apple menu in upper left corner, System Preferences, and Sharing.
In my case, the following image creation line worked for me within the Terminal:
sudo hdiutil create -size 250g -type SPARSEBUNDLE -nospotlight -volname "Mac Book Pro mb0 backup" -fs HFS+J -verbose ~/Desktop/mb0.sparsebundle
This line will create an image called mb0.sparsebundle on my Desktop.
We then want to copy the newly created image to the shared volume.
cp -rp ~/Desktop/[computer_name].sparsebundle /Volumes/[share]/
Where [computer_name] is your computer name.. mine is mb0.. Basically the file you created.. We're copying it over to the mounted share, which you've given your share a name.. We'll call it share for purposes of this guide. While you're typing the above line, when getting into the section called "/Volumes/", you can hit tab a few times and a few names will come up as suggestions.
Once the image has been copied over, you'll want to create a file within the image directory that you just created.
nano /Volumes/[share]/[computer_name].sparsebundle/com.apple.TimeMachine.MachineID.plist
Again, [share] is the name of your share and [computer_name] is the name of your computer. Nano is a text editor. Find the attachment below on this page called com.apple_.TimeMachine.MachineID.plist. Click it, copy everything and paste into the Terminal where you've ran the nano editor on the newly created file. You'll need to change two lines in the file before you save within the nano editor. The first thing to change is the MAC_STRING to match your machine. I was able to get this by running in another terminal window:
ifconfig en1|grep ether
Where en1 is the device I'm using, as I am using the Wireless card, not the wired network. Copy and paste everything from after "ether".. This is the MAC Address. Put this in newly created nano editor file that you have open where it says "MAC_STRING".. That line now should now read <string>00:11:22:33:aa:bb</string> or similar. The next thing to change is the UUID_STRING. You can find this under Apple Menu, About this Mac, click More Info..., and there should pop up an entry in the list on the right saying Hardware UUID. Copy and paste this number in place of the UUID_STRING in the file you're editing. Once done, hit [Control]+[x] to edit the nano editor. Hit [y] to save, and [enter] to confirm the file.
Open up a Finder window.Click GO from the upper menu bar and Connect to Server. Type in smb://[ip]. [ip] being the IP address of the Ubuntu machine. Click Connect.
Open Time Machine. Slide the slider to ON. Click Select disk. From the list, click your share and click Use for Backup.
Time Machine should backup!
Notes: hdiutil command line is ran on the Mac command line. I hope you're not trying to run hdiutil on linux. :)

