Blog

Ponderings of a kind

This is my own personal blog, each article is an XML document and the code powering it is hand cranked in XQuery and XSLT. It is fairly simple and has evolved only as I have needed additional functionality. I plan to Open Source the code once it is a bit more mature, however if you would like a copy in the meantime drop me a line.

Atom Feed

Installing Netatalk on OpenIndiana

ZFS for Mac Storage and Time Machine

It is possible to configure your OpenIndiana system to operate as a file server for your Mac using the AFP protocol, and if you have lots of lovely ZFS storage attached then it makes lots of sense. You can also configure OpenIndiana to act as as Time Capsule for your Mac's Time Machine!

The instructions below relate to OpenIndiana oi_151, and Apple Mac OSX Snow Leopard, however the procedure is probably much the same for all OpenIndiana versions. The Time Machine configuration does not work yet for Apple Mac OSX Lion, when I figure this out I will post the details.

Configuring OpenIndiana as an AFP File Server

First you need to install the pre-requisites for building Netatalk on OpenIndiana. You need gcc and BerkelyDB -

$ sudo pkg install gcc-dev 
            

You can download Berkeley DB from here. There are reported issues with version 5 and Netatalk, and so I used the latest 4.8 release. You then need to build and install Berkeley DB -

$ tar zxvf db-4.8.30.tar.gz
$ cd db-4.8.30/build_unix
$ ../dist/configure --prefix=/usr/local
$ make
$ sudo make install
            

Netatalk is a software package that acts as an AFP server. You can download Netatalk from here. You then need to build and install Netatalk -

$ tar xvjf netatalk-2.1.5.tar.bz2
$ cd netatalk-2.1.5
$ ./configure
$ make
$ sudo make install
            

After the install, Netatalk will be configured to share each users home folder. If you have additional folders that you wish to share with all users via. AFP you need to add them to /usr/local/etc/netatalk/AppleVolumes.default. I added these entries for my system -

/thevault/private/%u Private allow:@vusers
/thevault/public Public allow:@vusers
/thevault/timemachine TimeMachine allow:aretter
            

If you have different requirements for different Users then you can copy /usr/local/etc/netatalk/AppleVolumes.default to a Users home folder as AppleVolumes or .AppleVolumes and override the share settings for the user there.

If you want your AFP File Server to be auto-magically found via Apple's Bonjour service, you need to configure an Avahi service, this is done by creating the file /etc/avahi/services/afpd.service -

<?xml version="1.0" encoding="UTF-8"?>
<!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>

You now need to enable the Netatalk service and also the Avahi service, if you configured it above. Avahi also requires the Multicast DNS service -

$ sudo svcadm enable dns/multicast:default
$ sudo svcadm enable system/avahi-bridge-dsd:default

$ sudo /etc/rc2.d/S90netatalk start
            
Configuring TimeMachine on the Mac

If you created a TimeMachine AFP share above and wish to use your OpenIndiana server as a TimeCapsule also, then firstly you have to tell the Mac to allow unsupported network volumes for Time Machine. This can be done from the Terminal.app thusly -

$ defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1
            

You need to create a sparse disk image file, which will be used for the content of the TimeMachine backups. This can be done with the Terminal.app. The naming of the disk image is quite specific and should be of the form hostname_MACaddress.sparsebundle. e.g. -

Find your hostname -

$ hostname
hollowcore
            

Find your MAC Address -

$ ifconfig
en1: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    ether 90:27:e4:ea:7b:d4 
    inet6 fe80::9227:e4ff:feea:7bd4%en1 prefixlen 64 scopeid 0x4 
    inet 172.16.16.2 netmask 0xffffff00 broadcast 172.16.16.255
    media: autoselect
    status: active
</xh:pre>

Now substituting your own Hostname in place of 'hollowcore' and your own MAC Address in place of '9027e4ea7bd4' -

$ hdiutil create -size 300g -type SPARSEBUNDLE -fs JHFS+ -volname 'Backup of hollowcore' hollowcore_9027e4ea7bd4.sparsebundle                

Screenshot of MacOSX Connect to Server dialogYou should now mount your Time Machine share through the Finder by clicking Go -> Connect to Server... Entering afp://your-openindiana-hostname-here and then selecting the 'TimeMachine' share. You now need to copy the above Image file that you created to the mounted share.

Screenshot of MacOSX Time MachineYou can now launch TimeMachine, click 'Select Disk', wait for the mounted 'TimeMachine' share to appear and then click 'Use Backup Disk'.

Adam Retter posted on Saturday, 23rd July 2011 at 15.57 (GMT+02:00)
Updated: Saturday, 23rd 2011 at July 15.57 (GMT+02:00)

tags: OpenIndianaMacOSXTime MachineAFPNetatalkAvahiSolaris

Comments (3)


Thanks for the AFP tips. Have you by chance gotten NFS working between openindiana and Mac OS X? I can get the shares mounted and read/writable but the server drops connections and transfer speeds are beyond abysmal. I can't seem to find anyone else with my problem! ;-)
Hey Adam, thanks for the great info on afp. I'm new to apple and I've just installed OI_151 on a new HP Microserver to use as NAS. I've upgraded my mac mini server and my macbook pro to 10.7 lion so I'll be watching to see how to get afp working with lion.
OSX 10.7 has  added changes in the AFP stack. Most Unix/ Linux server based on netatalk 2.15 
have now problems with Lion (AFP and Time Machine)

To fix this problem a update of netatalk 2.2 with support for DHX2 is needed.
I  have updated my free online installer script  for a ZFS server based on free NexentaCore, 
OpenIndiana or comercial Solaris Express: 

installation with online installer after su to install newest available netatalk version 2.2.0p6 from
http://sourceforge.net/mailarchive/forum.php?thread_name=4E2C38E6.1090204%40fa2.so-net.ne.jp&forum_name=netatalk-admins
http://www.netafp.com/downloads/changelog/

installation/ update (as root or after a su)
wget -O - www.napp-it.org/afp22p6 | perl

After running this online installer, you have a working AFP server 


Complete Server and share management can be done via my napp-it web-GUI after running
wget -O - www.napp-it.org/nappit | perl

via browser at adress http://serverip:81
Maybee you like to try


Gea

Add Comment



(will not be shown)






Tag Cloud