Since I moved to a MacBook as my laptop a couple of years ago, I’ve had one continuing problem with backups. In my mixed Windows/mac environment I’ve used an HP MediaSmart Windows Home Server as my file storage solution for both systems and mostly that’s worked well.
At first Time Machine backups from Snow Leopard to this server worked fine as the HP server included software that allowed it to function as a native Time Machine destination. That stopped working with the changes that Apple made to Time Machine in Lion. HP being HP, they never updated their tools to work with Lion. Once I upgraded to Lion I found no good alternative so I changed to the use of an external USB drive to store my backups. I never really liked this solution since it required me to remember to plug in the drive on a regular basis. It also ran slowly at times and I didn’t like that it put part of my backups in a different place than the rest of them.
I finally found a solution that is not perfect, but is as close I’ve gotten. Recently I had to redo this when the disk that held the backups had some issues because of a bad hard drive on my server and thought it worth documenting. It’s been more than a year since I set this up so I can’t provide the links to the blog post that got me thinking this direction so unfortunately I can’t credit them. Still this is how to create a pretty good TimeMachine backup destination for a Lion or Mountain Lion Mac to a Windows Server. In fact it should work with any storage that is network accessible and doesn’t natively support updated Apple’s AFP protocol.
This works by creating an Apple disk image on a server share. This is the same concept used by VMWare and Parallels to create disk images for virtual machines. Here though we’ll set up a disk image that we can later mount from our Apple that works as a destination for our backups.
- Start the Apple Disk Utility. Easiest way is to bring up Spotlight and start typing in Disk Utility.
- Make sure that you do not have a drive selected and click New Image…
- I had problems creating the disk image directly on the external storage. When I tried creating the image on the remote storage it would never mount correctly. Instead I created the disk image on a local drive and then moved it to the server share. This would normally be a problem since we want our disk image to be large enough for our backups and therefore want it at least as large as our hard disk. To work around this, and save storage space until it’s needed, we’ll create a sparse bundle disk image. This type of disk only allocates space when it’s needed. It will run slower than a preallocated image, but I’ve found the difference isn’t noticeable.
- Now give the image a name. I used MacBook-Backup for mine. You will need this name later, so make sure it’s easy to type.
- Next skip ahead in the dialog and change the Image Format to sparse bundle disk image. This lets us create a disk image that will grow over time so we do not need to allocate all the space at once. It also let’s me allocate a 1 TB backup disk and still create it on the 500 GB SSD in my MacBook.
- You’ll want to size the image based on how much you have to backup and how long you want to be able to go back to retrieve data. Since I’d been using a 1 TB USB drive I decided to create the image the same size and found that’s worked well for me. Under the Size dropdown select Custom… to enter any size that you’d like.
- For format the default Mac OS Extended (Journaled) works fine so leave it.
- Encryption is optional. For an actual portable disk like the USB drive I’d consider encryption a necessity. With a network stored file the question is how much you trust the other people who may have access to your server. If you want to be safe, 128 bit encryption works well. I’m using it on my backup.
- You can create the image anywhere on your computer. I gave it the name MacBook-Backup.sparsebundle to make it clear what it was. Again since it’s a sparse bundle it will only initially use a small amount of disk space regardless of the size of the disk image.
- Once Disk Utility finishes creating the image, unmount it, and move it to your remote storage. In my case I created a new share on my server and gave my account read/write access to that share. I then moved the file into the share.
With the image file now on my storage, I next had to tell my Mac where this file was and to use it as the Time Machine destination. If you try to do this through the GUI as normal you’ll see that only external drives and AFP supporting devices (generally either a Time Capsule, Airport Base Station, or NAS with the necessary support) show. Instead we need to use the tmutil command to tell Lion where this image file is
To do this I found the easiest approach to first mount the image to your computer. To do this connect to your external storage where you placed the file. In my case this was a cifs share and I mounted it using the Go -> Connect to Server… option in Finder. Once I did this it and I entered my login credentials I could see the disk image. To mount the image double click on it. If you created an encrypted image you will be asked for the password. You can choose to store the password in your keychain so you will not need to enter it each time. Once the image is mounted, you will see it in Finder under Devices much as you would an external drive. The name will be the image name you entered in step 4 above.
If you want to move any existing Time Machine backup you can do so. Apple provides instructions to do this at https://support.apple.com/kb/HT5096. In this case the disk image functions just as an external drive would. It takes time, but allows you to keep your existing backup data.
Next start Terminal. At the prompt enter the following command to tell Apple where our Time Machine destination will reside:
sudo tmutil setdestination /Volumes/Mounted Image
Change Mounted Image to the name of the device in Finder after you mounted it. In my case since I gave it the name MacBook Backup in step 4, my command is:
sudo tmutil setdestination /Volumes/MacBook-Backup
Try running a backup now by going to the TimeMachine icon and select Backup Now. Depending on how much data you have on your Mac and the speed of your network it might take a while. If you have a lot to backup the first time doing so with a network cable instead of wireless can speed it up significantly. If you have an existing backup it may be faster to transfer it to the new image which will allow the backup to pick up from there.
After a few days this is working well. I’m now getting regular backups instead of only when I remember to plug in the USB drive and have the time to let the backup run. I’ve found the backups over my wireless to be much faster than over the USB 2 in my MacBook. I also feel more confident my backup is up to date and will cover if something happens to my laptop or hard drive.
It’s not perfect though. Since this is for all purposes an external drive it functions much as connecting a physical drive and not as a network destination. To kick off the backup, you must manually attach to the server and mount the drive. I’ve also found that when networks other than my home, I get errors about not being able to connect to the storage when the Mac attempts to start the backup. I’ve generally just ignored these since there seems to be no problem other than the error message.