Update 4/24/12: Added login user/password tip
Update 11/15/11: Corrected error in original appliance
Recently I came across a SmallNetBuilder reader on the forums who was planning to build a Windows-based home server. As a Macbook Pro user, one of his needs was to have his server act as a target for Time Machine backups. Not an unreasonable request, but apparently more difficult than you might think. I suggested using Linux instead, but he was keen to stick with what he knew.
Apple, of course, sells the Time Capsule, so backing up over the network is possible. Requirements for backing up over the network include the use of AFP (Apple Filing Protocol) 3.2 or above.
Other people have used the TMShowUnsupportedNetworkVolumes hack in MacOS X to use a Windows file share as a Time Machine. But this has since shown to result in data loss once you start to fill up your disk. So this option is not recommended!
Regular readers of SmallNetBuilder will be aware that many NASes now come with TimeMachine support built in. This is courtesy of Netatalk – the open source implementation of AFP.
But back to Windows. Netatalk is open source, so probably also works on Windows, right? Apparently not, although why this is so remains a mystery to me. Microsoft itself used to include AFP compatibility in Windows Server, but they have pulled it as of Server 2008. Besides, it was only version AFP 2.2, so of no use for Time Machine.
As far as commercial products go, GroupLogic's ExtremeZ IP supports Time Machine on Windows. But as this is SmallNetBuilder and not LargeCorporateNetBuilder, the $795 for 3 licenses pricetag is probably out of reach for most readers!
So what does that leave us with? Not a lot, unfortunately. So it got me thinking. There must be plenty of users out there who have a Windows-based server but have a few MacOS X users who would like to use said server to do their Time Machine backups over the network. What can SmallNetBuilder do to help them?
The solution I came up with was to use a virtual machine on Windows to host Linux running Netatalk. The idea would be to keep it as ‘appliance-like’ as possible, so that it could easily be downloaded installed and would be unlikely to go astray.
Now before the nay-sayers start, I agree this isn’t the most elegant solution. But it provides an alternative that is infinitely better than the current TMShowUnsupportedNetworkVolumes hack!
This article will first walk you through installing a virtualization solution on a Windows system. You'll then have the option of installing a preconfigured "appliance" to handle Time Machine backups. Or you can go through the gory details and create your own appliance for installation.
This Part 1 will give you the easy way to get up and running by first installing a virtualization solution on a Windows system and then a preconfigured virtual appliance. For those who want to understand the whole process so that they can create their own version, you'll get that all in Part 2.
Note that the result is not going to be a high performance solution. But that’s ok, since Time Machine backups are relatively low bandwidth once the initial backup is done. If you're looking for an enterprise-grade solution for handling an office full of Macs running Time Machine backups, you'd be better off using a full blown (non-virtualized) Linux server or talk to GroupLogic (and get your checkbook ready). So with the introduction out of the way, let’s begin.
As previously mentioned, we are going to be running virtualized Linux. So we must choose a free virtualization solution. Three candidates were considered for the article and, to be honest, there isn’t a lot to choose from. But there is no reason why the techniques I use here won’t work in another version. So my choices were VMware Server, Oracle's Virtualbox and Microsoft's Virtual PC. All three run on an existing Windows installation (i.e. they don't require a ‘bare metal’ install).
VMware Server is a great, mature product, but a bit of a beast (a 500 MB download!) and probably overkill for this project. I don’t have too much experience with MS Virtual PC, but it seems as good as any free VM solution.
This leaves VirtualBox, my preferred choice because I have used it the most. It is also (partially at least) available as open source (which we like). The download is only 1/6th of the size of VMware, too. The downside is that as a desktop package, it is not so easy to run the VM as an always-on service, but we’ll fix that later.
As I said, all products will work so use the one that you are most comfortable with.
The Easy Way
For those of you who just want to cut to the chase, there are two steps.
1) Go download and install Virtualbox from http:/www.virtualbox.org. I used version 4.1.2-7350 and run it on a Lenovo T420 laptop with Windows 7 Enterprise 64-bit with 8 GB RAM. Note that if you're installing on Windows XP, you may get a number of errors and warnings. Just click on through them to finish the install.
2) Download the Time Machine appliance file from here. Double-click to install it.
Update 11/15/11 Note: There was an error in the original appliance that will throw a disk permissions error when you try to connect to the Time Machine appliance. If you downloaded the appliance before 11/15/2011, you need to download the updated version and install it.
Or you can use the original appliance, log into the VM with root/tmroot and type in
chmod 777 /mnt/MyTimeCapsuleData
That's pretty much it. Your virtual MyTimeCapsule device should be visible to your Macs and you should be able to use it to store Time Machine backups.
You will probably want to create a service for the virtual machine so that it starts when Windows starts and cleanly shuts down when Windows does. We are going to be using a free Windows application called VBoxVmService. Download it and then extract the vms folder to your C drive root directory (c:\). Easy to follow documentation can be found in c:\vms\doc\Howto.txt.
First, navigate to the vms folder and open up VBoxVmService.ini in notepad.
You need to modify the second line to add your user name. Mine became:
Edit the section called [Vm0] and change it so that it looks like:
Then save and close the file.
Now you just follow the steps in the Howto.txt document:Step 1. (for WINXP / SERVER2003) Launch CMD (Command Prompt) from your start menu.
Step 1. (for VISTA / SERVER2008 / WIN7) Right-click on CMD (Command Prompt) and choose "Run as Administrator" from the context menu.
Step 2. Install the service. Within the terminal window type:
cd C:\vms [ENTER]
VmServiceControl.exe -i [ENTER]
Step 3. Reboot your system.
That’s it! Just restart your Windows system and make sure that the virtual MyTimeCapsule device appears.
Update 4/24/12 note: If you are asked for a login details at any time you will need to log in with tmuser as both username and password.
Virtual Machine Creation
For the brave souls who want to craft their own appliance, you'll first need to choose a Linux distro. Debian was my first exposure to Linux all the way back in 2005, when I wrote the Xbox NAS article. Ever since then, it has been what I have used for all my Linux server installations. I love it, so I'm going to be using it here. It has easy package management, a relatively small footprint (if properly configured) and installing Netatalk is a walk in the park.
I did investigate some other distros with the aim of reducing the installation size: Damn Small Linux (small but not so easy to install Netatalk); Gentoo; Linux From Scratch (too much effort for a relatively small return); and CentOS (no real benefit from Debian).
So Debian it is.
Usually, I would use Debian Testing (currently called Wheezy). But while installing it for this article, there were bugs with the installation process. So I gave up and went with Stable, version 18.104.22.168, currently called Squeeze. But the current release has changed and will continue to do so in the future.
So pick up the latest version here. Using 22.214.171.124 does mean we will need to pick up the Testing version of Netatalk later though. The i386 version is used because it has a small installed size. Since we are using only 128 MB RAM, a 64 bit version is not required.
Let’s fire up VirtualBox and create our machine.
Click New to launch the New Virtual Machine Wizard. On the VM Name and OS Type screen, I entered MyTimeCapsule for a name, Linux for operating system and Debian for OS version (Figure 1).
Creating the Virtual Machine
On the Memory screen, use the slider or text entry box to choose 128 MB of memory.
Setting VM Memory size
On the Virtual Hard Disk screen, check the Start-up Disk box and click the Create new hard disk radio button
Create hard disk
On the next screen, select the VDI (VirtualBox Disk Image) button.
Hard disk type
And on the following Virtual disk storage details screen (not shown) select Dynamically allocated for Storage details.
On the Virtual disk file location and size screen, accept the default Location shown in the screenshot below and enter a 1.0 GB size.
Hard disk location and size
After you click Next, you'll get a Summary screen reporting your settings (not shown). If everything is OK, click Create. Otherwise click Back to make whatever changes you need.
After your VM is created, you'll see the screen below.
We next need to tweak some settings on the Virtual machine we've just set up. So select your new VM and click Settings. Select System and uncheck Enable absolute pointing device as shown below.
Now move to Display, select the Remote Display tab, check Enable Server and enter a port other than the 3389 default. I chose 33891 as shown below.
Move to Storage, which will show IDE and SATA controllers as shown below. Select the IDE Controller and delete it by clicking the icon shown.
Storage before changes
This will delete the virtual IDE CD/DVD device, so we need to add a SATA one. Click the left icon (Add CD/DVD Device) of the two that are to the right of the SATA controller (mousing over each one will reveal the correct one). Then click the Choose Disk button in the window that pops up and select the Debian ISO you downloaded. When you're done, the Storage settings should look similar to those below.
Storage after changes
On the Audio settings, uncheck Enable Audio.
Moving to Network, change from NAT to Bridged Adapter. Then expand Advanced and change Adapter Type to Paravirtualized Network (virtio-net) as shown below.
Finally, for USB, just uncheck Enable USB Controller.
Now click OK to close the Settings window.
We will also create another virtual hard disk to store your Time Machine data on. I suspect we will take a bit of a performance hit storing it in a virtual disk. But hopefully it won’t be noticeable and it will make the configuration easier. I am going to create disk that will expand up to 100 GB, but initially will be empty. Feel free to create one of a size that suits you.
Select your virtual machine and click Settings.
Click Storage then select the SATA Controller. Now click the Add Hard Disk icon (right hand one) and then the Create new disk button in the window that opens, which will launch the wizard. You've seen these screens before, so just enter these settings on the approprirate screens:
- First screen: VDI
- Details: Dynamically allocated
- Location/Name: MyTimeCapsuleData
- Size: 100 GB
- Click Create and you are done
That's it for this time. In Part 2, we'll install and configure Debian and Netatalk and show you how to create your own virtual appliance for it all.