Setting up FreeBSD as a fileserver and Time Machine target in Mac OS X

Couldn’t find a post that was up to date, the closest one I found was this:

http://thomas.pelletier.im/2010/01/time-machine-freebsd-and-afp-are-on-a-little-boat

But it recommends Howl, which is deprecated. I decided to replace it with avahi.

I based the avahi setup on these posts:
http://www.kremalicious.com/2008/06/ubuntu-as-mac-file-server-and-time-machine-volume/

http://www.endeavoursofanengineer.com/blog/2010/05/08/installing-avahi-on-freebsd-2/

Lets go.

First, update ports

# portsnap fetch extract update

May have to update libtool to 2.4

# portupgrade libtool

Install Netatalk

# cd /usr/ports/net/netatalk/ && make install clean

Edit /usr/local/etc/AppleVolumes.default and add your shares(below is how mine looks, replace MyUser with you local user on the FreeBSD machine):

/tank/misc/timemachine/ “Time Machine” allow:MyUser options:tm
/tank/misc “Misc” allow:MyUser
/tank/movies “Movies” allow:MyUser
/tank/tv “TV” allow:MyUser

Install Avahi

# cd /usr/ports/net/avahi && make install clean

Install nss mDNS

# cd /usr/ports/dns/nss_mdns && make install clean

Edit /etc/nsswitch.conf and add mds to the hosts line, so it reads:

hosts: files dns mdns

Edit(well, create the file since it doesn’t exist) /usr/local/etc/avahi/services/afpd.service and add the following:

<?xml version=”1.0″ standalone=’no’?><!–*-nxml-*–>
<!DOCTYPE service-group SYSTEM “avahi-service.dtd”>
<service-group>
<name replace-wildcards=”yes”>%h</name>
<service>
<type>_afpovertcp._tcp</type>
<port>548</port>
</service>
<service>
<type>_device-info._tcp</type>
<port>0</port>
<txt-record>model=Xserve</txt-record>
</service>
</service-group>

Now add the following to /etc/rc.conf

netatalk_enable=”YES”
afpd_enable=”YES”
cnid_metad_enable=”YES”
dbus_enable=”YES”
avahi_daemon_enable=”YES”

Start all daemons

# /usr/local/etc/rc.d/dbus start && /usr/local/etc/rc.d/avahi-daemon start && /usr/local/etc/rc.d/netatalk start

On the client(the OS X machine), enable “unsupported” network volumes, in a terminal run:

# defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1

Hopefully, your server should now show up in finder with a nice Xserve icon, and also be selectable in Time Machine. Now as I’m using ZFS on my shares on the FreeBSD server it seems I don’t need to create a sparse file, Time Machine does that itself. But if you’re using UFS you may have to create one, see the first link in this post.

UPDATE: If you’re getting the error “The network backup disk does not support the required AFP feature.” in OSX Lion that means you need to upgrade netatalk to 2.2. In FreeBSD a simple “portsnap fetch extract update” followed by “portupgrade netatalk*” and “/usr/local/etc/rc.d/netatalk restart” should do the trick.

<!–RndAds–>

<!–RndAds–>

<!–RndAds–>

 

This entry was posted in FreeBSD, OSX and tagged , , , , , , , , , , , . Bookmark the permalink.
  • techtangents

    Thanks. This helped me switch from Howl to Avahi.

  • Worked like a charm, cheers!

  • litfan

    Tried this on PC-BSD and it’s not working 🙁 Back to the drawing board.

  • ben

    The problem is this: shares should NOT be in /usr/local/etc/AppleVolumes.default – this file is never read.

    INSTEAD, put shares definitions in /usr/local/etc/afp.conf

    If you want to know the proper syntax for this file, check man afp.conf, or just search the net

    YOU WILL ALSO NEED netatalk3 in /usr/ports/net/netatalk3, NOT netatalk (which is nettle protocol 2)
    Everything else in this tutorial, all things being equal, will work as long as you define your shares in afp.conf, the place that netatalk (or avahi I guess?) actually looks.

    NOTE: I am using Yosemite. Mavericks and below may only support afp protocol v2, so then you may want plain netatalk and not netatalk3. However 3 seems to have way more options, and the afp.conf file is similar in configurability and syntax to smb.conf, so it would probably cover older versions also anyway.

  • hanifah

    hö lata vän om du reser på bio för att se din favoritfilm … Jag har en mycket bra lösning ska vara enkelt ….. din vän bara klicka på den här webbplatsen eller så kan du också ladda ner den buwat samling ” ‘Det här stället är så mycket cuku stora filmer för sågen ___ klicka bara på site = ===================== >>>>>>> ONLINEHD.CINEMAS4U.US