Create your very own Linux based Time Capsule for Mac OS X!

Linux? That sounds hard and boring…

Waiiit! Don’t leave just yet! Even if you have no Linux experience at all, you will easily be able to follow this simple guide and setup your very own, DIY Time Capsule. You don’t even need a separate computer!

Please take a look here if you have OS X 10.9 Mavericks

I will to try to write this guide as simple as possible, but with the possibility to get more information, should you want it. Bear in mind that I’m writing this tutorial so that anyone can easily follow it.
Even though this guide could work with several versions of Linux and Mac OS X, I am going to concentrate on Ubuntu Linux 12.04 and Mac OS X 10.8.

Ubuntu Server 12.04 64bit to be exact. This is the current long-support version of Ubuntu Server, and is possibly the most stable version.
Mac OS X 10.8 is the newest OS from Apple (10.9 Mavericks in the making), so I will concentrate on this version. But don’t worry, this guide will most likely work perfectly on 10.7, and maybe older versions as well. I don’t have the opportunity to test it, so if you succeed on an older version, please leave a comment!

As this is going to be a backup-server, a 24/7 uptime is highly recommended. I have a Windows Home Server (WHS 2011) where I installed a virtual Linux server, but you could install it on an old desktop computer or a laptop with a dead monitor etc. Just about anything with some storage will do! I recommend internal storage!

OK – Let’s get on with the tutorial:

What separates this guide from all the other guides I’ve found?

A lot of the guides has unnecessary steps, including guest access and hacking your mac to show unsupported network volumes. This is not recommended, as it could give false backups if the backup volume is out space.

This is the code that almost all the other guides have:

Defaults write TMShowUnsupportedNetworkVolumes 1

I have written this guide to help you create a Time Capsule as close to OEM as possible, no extra edits on your Mac necessary.

Installing VirtualBox

I will start by installing VirtualBox and Ubuntu. Even though you have a server running, it could be a good thing to test with a virtual environment first. You could use VMware ESXi (VMvisor 5.1) or something similar to create multiple servers on a single computer, but I’m going to install VirtualBox on top of a running operating system.
PS! Make sure you have hardware virtualization enabled in your computers BIOS! Read up on your hardware manual to see how. Or else you won’t be able to virtualize a 64-bit processor.

Download VirtualBox here

Installation is like any normal application install, but remember that VirtualBox will reset your network card during install, this is to create a shared network so that your virtual machine(s) can get an IP from your router.

This is what you will meet after install, except you won’t have a virtual Windows XP computer of course. Click New to create a new computer. Then give it a fitting name (only for VirtualBox) and choose Linux and Ubuntu 64bit. All options I choose were defaults, but I’ve listed them here anyways:

VirtualBox with Windows XP on a virtual machine.

VirtualBox with Windows XP on a virtual machine.

Choose a name and correct OS

Choose a name and correct OS

512MB RAM might be overkill, but I have 16 GB to spare

512MB RAM might be overkill, but I have 16 GB to spare (4GB on this computer though)

Create a brand new hard drive. Don't worry - It's free!

Create a brand new hard drive. Don’t worry – It’s free!

Choose VDI

Choose VDI

Dynamically allocated will expand as needed

Dynamically allocated will expand as needed

10GB is more than enough for the Ubuntu installation. We will create a secondary drive later for backups.


And there you go! You have successfully created a brand new virtual computer. Now we need to install an operating system, and later add some storage.

A virtual machine optimized for Ubuntu successfully created

A virtual machine optimized for Ubuntu successfully created

You should now open settings, then network, and choose “Bridged Adapter”. This will make sure your Time Capsule will be visible on your LAN, it will get an IP from your router and act as a normal separate computer.

Bridged Adapter gives your TimeCapsule it's own IP on your LAN

Bridged Adapter gives your TimeCapsule it’s own IP on your LAN

Installing  Ubuntu Server 12.04.

You now have to download the Ubuntu Server image (656MB). Please choose Ubuntu Server 12.04.2 LTS. It will take a couple of minutes to download, depending on your Internet connection.

Now, start your virtual machine, and you should be prompted with a window asking you to choose a startup disk. If not, go to settings, choose storage, and click the one named “Empty”. You should be able to browse for an image file (Ubuntu download) at the right.

Browse for your ISO-file (Ubuntu Server)

Browse for your ISO-file (Ubuntu Server)

Click the small CD to choose a DVD/CD or an ISO image.

Click the small CD to choose a DVD/CD or an ISO image.

Then the Ubuntu ISO should boot in a console window, and you’ll be prompted to choose your language for Ubuntu. Then just click Install Ubuntu Server. (PS, notice that you have a so called “Host Key” displayed at the lower right corner of the console window, this is to break out of the virtual machine console. On Mac it is your left cmd-key).

Go ahead and install!

Go ahead and install!

You will be prompted with several language selections. Click enter after choosing your preferred options.

You will have to choose your regional settings before installing

You will have to choose your regional settings before installing

After identifying your keyboard, you will be prompted to give a hostname to your Time Capsule. I recommend “TimeCapsule” as a name. This is the name that will be seen on your network. Don’t use spaces! To easily move between text and navigation buttons (Go back, Continue), click the tab-key. You can also just press the down arrow.

Set a hostname for your Time Capsule server

Set a hostname for your Time Capsule server

Continue with writing your name and a username, or just put “Time Capsule” as full name and “timecapsule” as username.
Choose a password and remember it!

Be sure to remember your password!

Be sure to remember your password!

I choose not to encrypt my home directory, but this is optional.

Encryption is optional

Encryption is optional

After the installer has found a time server etc, you will be prompted to choose a partitioning method.
Choose the first one. You don’t need LVM for a simple server like this. You can choose it, but then you probably know what you’re doing. It’s mainly just the possibility of having a logical drive stored over multiple physical drives. On a small virtual server like this, it’s really not needed.

LVM is not needed on a simple setup like this

LVM is not needed on a simple setup like this

Select the drive (the only option) afterwards, and choose yes to write changes to disk. Ubuntu will start installing just after. When asked for proxy, you can click continue, and leave it blank. After this you could take a small break, go grab a coffee. This shouldn’t take to long.

When asked about updates, leave it at default with no automatic updates. This will ensure that no updates will break the setup. It’s better to do manual updates from time to time.

No automatic updates please...

No automatic updates please…

Then you’ll get the option to install some extra software. Install OpenSSH, but leave the rest blank. (Choose with space, then click tab and choose “Continue”) OpenSSH will give the opportunity to log in to your server through terminal. This is much easier than opening VirtualBox.

This will take a couple of minutes, and you will be prompted with the GRUB installer. Click yes to install. This is the bootloader for Ubuntu on your virtual machine.

Seconds after, your installation is finished! Congratulations! Make sure your Ubuntu ISO is unmounted (through settings -> Storage, it should read empty under “Controller: IDE”. ) Click continue to restart the virtual machine. It should take approximately 10 seconds to boot.



When booted, you’ll be met with a login. Bear in mind that if you have taken a quick break after the reboot, and now came back to a black screen, just click a key inside the virtual machine console, and you should be met by the Ubuntu login. Insert your username (click enter) then your password. (PS. There are no stars when typing the passwords).

Logged in as user time capsule

Logged in as user time capsule

First of all, to make things easier, log in as root. This will give you administrator rights, and make it possible to do changes on the system. Write “sudo su” and your password when prompted

sudo su

Notice that you are now located at “root@TimeCapsule:/home/timecapsule#.

The first thing you should do is update the system. It’s easily done by writing the following:

apt-get update && apt-get upgrade

When asked if you would want to continue, click enter. You can see that it says “Y/n”. As “Y” is in capital letters, it’s the default choice.

Then let it do its thing, it shouldn’t take to long before you’re ready to continue. This could also be a good place to continue your coffee or take a small break before we start installing the actual services.

Just finished updating Ubuntu

Just finished updating Ubuntu

Install Netatalk and Avahi

Netatalk is an open source version of AppleShare File System (AFP) which will give the ability to create Macintosh and TimeMachine supported shares. Avahi is an open source Bonjour service, which will announce your shares for your Macs. Avahi is included with netatalk, but I experienced problems with the Time Capsule not being listed, so to be sure, we will install both netatalk and avahi-daemon.

It’s easy! Run this command:

apt-get install netatalk avahi-daemon

and click enter. You should be prompted with a message asking if you want to continue, click enter again. It should be approx. 7MB. This should only take a couple of seconds to finish.

Now we’re going to edit its configuration file with Nano, a simple text editor. Write the following command:

nano /etc/netatalk/afpd.conf

Now hold Ctrl+V to scroll down to the last line.

There’s a “#” sign in front of the line, remove it. This is a comment sign, which disables the following line.

It should now look like this:

- -tcp -noddp -uamlist, -nosavepassword

What’s worth noticing here is “” and “”. These are the authentication methods, the “Diffie-Hellman eXchange” and “Diffie-Hellman eXchange 2”. The latter being the most advanced and secure.

I removed “” from my configuration , as DHX is no longer supported from 10.7 Lion and up, this because Apple has considered it insecure. DHX2 is supported from OS X 10.2, so all Time Machine supported Macs should only need the latest DHX2 authentication, thus making the system a bit more secure. “” is needed, or else you will only get “This server is not supported” when trying to connect.

This is also the reason why a lot of NAS devices has lost Time Machine compatibility from 10.7 Lion, they don’t support DHX2.

My config:

- -tcp -noddp -uamlist -nosavepassword

If you don’t want to mess around with these settings, you can just remove the “#” sign in front, and that’s it!

More info on afpd.conf.

Some recommend adding “”, which could resolve  an error in Ubuntu Syslog due to a bug in netatalk:

INTERNAL ERROR: Signal 11 in pid 2413

I haven’t experienced this error with my configuration, so it could be corrected in the newest version of Netatalk. 

To exit nano after doing your changes, press Ctrl+X, then Y (for yes) and click enter (overwrite the file).

To exit, click Ctrl+X, then Y to save, then Enter to overwrite file

To exit, click Ctrl+X, then Y to save, then Enter to overwrite file

If you have followed everything in this guide, you’ll need to setup an extra hard drive for storage. To do this, you have to turn of the virtual machine.

The easiest way through VirtualBox is to click the red X on the console window and choose “Send the shutdown signal”.

You can also do it by command:

shutdown now

If it fails, try this command:

shutdown -h now

You should be back on the VirtualBox application, and you can choose your Time Capsule machine, and click settings.

Click storage, Controller: SATA and then the most right icon, it should say “Add Hard Disk” when hovering over. Then choose:

1. Create new disk
2. VDI (VirtualBox Disk Image)
3. Dynamically allocated
4. Name it “Storage”, and choose a size. It should be larger than your Macs hard drives
5. Click “Create”.

Adding a new drive

Adding a new drive

I choose a 15GB disk for this test, but it would more likely be 1-2TB in a normal Time Capsule setup.

New drive created

New drive created

After this you can start the virtual machine again.

When booted, login again, and write:

sudo su

as you did earlier in the install. Enter password when prompted and you should be back at root.

We now have to mount the hard drive, and make sure it remounts when rebooted. This is the same procedure as for a physical machine.

Write “fdisk /dev/sd” and click tab. You now get a list over all valid commands. As you might see, you have sda, sda1, sda2, sda5 and sdb.

My drives and partitions

My drives and partitions

Sda and sdb are the two drives. S-ATA drive A and S-ATA drive B. 1,2 and 5 are partition numbers (these were created automatically during install. sda refers to the whole drive.

You can also list them all by writing “fdisk -l” when root.

We want to concentrate on sdb which doesn’t have any partitions, and is therefore likely to be our new harddrive.

PS! If you are on a physical computer, you might have different drive names, but in any case, it will most likely be sdb if you have two drives, and also the one without a number behind. If you are in doubt, you can turn off the computer, remove the drive you want to use, and boot up again and check which are available. This could help you identify the drive easily.

So, as we want to use the sdb drive, we write the following command:

fdisk /dev/sdb

You will get a warning stating that the drive doesn’t contain any valid partition table, this is normal, as the drive is empty.
We will continue with creating a primary partition, which is fairly easy. Follow these steps:

n (enter)
p (enter)
Click enter until you're back to (m for help)
w (enter)

You have now successfully created a New Primary partition with the partition number 1 which is using all the sectors on the hard drive, and Written the changes.

Now the drive is configured with a partition, and we have to format it. Write the following command to format our partition with ext4:

mkfs.ext4 /dev/sdb1

The next thing to do is make sure it is automatically mounted. We will mount it at “/mnt/TimeCapsuleData”

mkdir /mnt/TimeCapsuleData
chmod 777 /mnt/TimeCapsuleData
echo /dev/sdb1 /mnt/TimeCapsuleData ext4 defaults 0 0 >> /etc/fstab
mount /mnt/TimeCapsuleData

And there you go! Your drive has been partitioned, formatted and will now be mounted at every boot.

The last thing we will do is to set this as our Time Capsule storage:

nano  /etc/netatalk/AppleVolumes.default

Scroll all the way down with Ctrl + V, and go a couple of lines up. You’ll see “~/   “Home Directory “”. Put a “#” sign in front of it, which will disable the line.

Go to the line under, and write:

/mnt/TimeCapsuleData "TimeCapsule" cnidscheme:dbd options:usedots,upriv,tm allow:timecapsule

The first setting is the path to the backup location, the next, “TimeCapsule” is the name of the server. This could be anything, “My Ubuntu Time Capsule” etc. With both hostname and storage being called “TimeCapsule”, you will in Time Machine on your Mac see “TimeCapsule on TimeCapsule”.

Alternatively, if you want to limit how much of the drive that could be used, you can set it like this:

/mnt/TimeCapsuleData "TimeCapsule" cnidscheme:dbd options:usedots,upriv,tm volsizelimit:100000 allow:timecapsule

Notice the “volsizelimit:100000” setting. This means that the volume limit is 100.000MB, or 100GB. The last parameter “allow:timecapsule” this is the username for the user who will administrate the Time Capsule. Just use the user you set during Ubuntu install. Also notice the “tm” option, this is the only thing separating this from a normal AFP-share.

When you have set your options, exit and save with “Ctrl + X” ,then “Y” then enter to overwrite.

The line isn't showing "allow timecapsule" to the right. It can be scrolled.

The line isn’t showing “allow timecapsule” to the right. It can be scrolled.

Last command:

service netatalk restart

You could also restart the whole server.

shutdown -r now

If you need to access the server later, you could either go through VirtualBox, or use ssh, as we installed earlier. Open terminal on your mac, then write your username and IP-address. Not sure of your IP? Write “ifconfig” in the VirtualBox console. You should either set the IP to be static in Linux, or better just reserve the IP-address on your router.

ssh username@ip-address


ssh timecapsule@

Then enter password when prompted. You will be in the same shell as available through VirtualBox.

On your Mac:

Open the Time Machine preference pane, and click “choose disk”. You should now see your available Time Machine backup shares.

You should see your server in Finder, and your shares in Time Machine

You should see your server in Finder, and your shares in Time Machine

Hope this guide could help you!

If you experience problems, please leave a comment!


30 thoughts on “Create your very own Linux based Time Capsule for Mac OS X!

  1. Pingback: Expanding your DIY Time Capsule with multiple logins | A SysAdmins Perspective - Living-On-Line

  2. Pingback: Create your own Cloud service – it’s free! | A SysAdmins Perspective - Living-On-Line

  3. Thanks so much for doing this tutorial! On my OSX Mavericks DP8 Mac Mini, it asked for username and password to authenticate me, and then errors out afterward. I followed the 2nd part of your tutorial about creating specific user spaces with separate authentication, and that worked like a charm. Thanks again!

  4. Pingback: Upgrading Netatalk on your DIY Time Capsule and adding better support for Mavericks | A SysAdmins Perspective - Living-On-Line

  5. Pingback: G3 PowerBook Pismo als TimeCapsule Ersatz einsetzen | 木 online

  6. If using Ubuntu 12.04 server, you need to comment out the following line from from /etc/pam.d/common-auth otherwise you’ll get authentication issues.

    auth optional migrate

    Thanks for the tutorial!

  7. Hello, I’d like to try this, but I keep getting: “bash: syntax error near unexpected token `newline’ ” after this command “nano /etc/netatalk/afpd.conf” . Granted I’m now trying it on Ubuntu 14.04LTS

  8. Hey, thx so far for the Tutorial but i´ve got 1 Problem. I followed the whole tutorial and got now an authentification error on my mac that tells me i don´t have permissions to read,write or execute. Can some1 help me with that?

    • OP, can you update your instructions to include the “-c -R” in line #2 under this heading in your tutorial “The next thing to do is make sure it is automatically mounted. We will mount it at “/mnt/TimeCapsuleData” “

      • Hmm, I noticed that I haven’t replied, sorry about that! Why would “-cR” be necessary here? We want only the “TimeCapsuleData” folder to be accessible by all, the subfiles will be created by the mac’s (sparse bundle files).
        I would recommend the newer post I made with Mavericks support. It’s easier to have multiple users in different folders, and use “chown” to make them readable for only the user. We do this at my office, and it works great.

  9. Pingback: Linux Ubuntu 14.04 LTS for media server + NAS + Torrents + Time Machine + Plex Server, all with Raid 1

  10. cool!
    thanks a lot

    installed it on my WHS11
    on the Ubuntu VM everything (seems) to be fine.
    I can see the mounted share, I can access and create files

    I see the Timcapusle server on my Mac, but can’t connect
    I can ping the server from my windows PCs but I don’t see the server/ share in the file explorer
    Connection with Firefox also fails

    do I need samba to translate credentials?

    sorry but I am an absolute Linux dummy

      • Great! It’s usually a small configuration or permission error. Finding these usually takes 10 times longer than the full setup 😉

      • me agian

        works almost perfect, when the client is on (OS X Yosemite 10.10.2) and I start the netatalk (apt-cache show netatalk: 2.2.2-1ubuntu2) service everithing is fine, I see the server, TM works.
        When I shoutdown the client the server is gone (don’t see it in the network, mounting does not work).
        As soon as I restart netatlak everithing is fine (also for some hours)

        seems as the server don’t get some kind of restart demon?

        greetings from Austria

      • So when you restart your CLIENT, the SERVER stops working? I don’t see why that should happen.

  11. first of all, thank you for your great walkthrough! I have it up and running 🙂

    What performance did you reach? I have a 1gb network, and got it nearly saturated when copy files from finder to TC-VM. But when i do a backup with TC i got only 5-9% of 1gb. Is this normal?
    I have to say, that i’m a complete mac newbie.


    • I typically got 50-60MB/s at most with a typical HDD. It varies, especially if there’s a lot of small files, the initial backup might take a long time.
      The initial backup might take all night, but after that it should be much faster, try adding a large file afterwards, and check the network traffic while taking backup of the new file.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s