Time Machine on SmartOS

  • Fri 17 January 2014
  • misc

I promised some articles involving doing things with SmartOS. One of the first things I did after getting the machine at home up and running was build a VM that contained an AFP fileserver that was capable of acting as a target for Time Machine. I built some external ZFS partitions that are loopback-mounted into the VM, one per Mac that's backing up to it, the better for snapshotting and off-site-backup-of-the-backup.

Here's the JSON spec and my (relatively crude) notes from creating the VM. This is not a HOWTO, just notes that may prove useful.

[root@a0-b3-cc-e8-95-9a /zones/rs]# cat  netatalk3-201309.json
  "brand": "joyent",
  "image_uuid": "0084dad6-05c1-11e3-9476-8f8320925eea",
  "resolvers": [
  "filesystems": [
     "source": "/zones/afp2",
     "target": "/afp2",
     "type": "lofs"
     "source": "/zones/tm/pinkerponk",
     "target": "/tm/pinkerponk",
     "type": "lofs"
     "source": "/zones/tm/billet",
     "target": "/tm/billet",
     "type": "lofs"
     "source": "/zones/tm/kimby-mbp",
     "target": "/tm/kimby-mbp",
     "type": "lofs"
     "source": "/zones/tm/rs-twc-17",
     "target": "/tm/rs-twc-17",
     "type": "lofs"
  "alias": "netatalk3-201309",
  "nics": [
     "nic_tag": "admin",
     "gateway": "",
     "ip": "",
     "netmask": ""

[root@a0-b3-cc-e8-95-9a /zones/rs]#

Some random urls with notes, mostly related to netatalk 2.2.x http://wiki.smartos.org/display/DOC/How+to+create+a+zone+(+OS+virtualized+machine+)+in+SmartOS http://be.groovie.org/2012/09/17/trying_out_smartos_and_openindiana.html http://marcoschuh.de/wp/?p=839

I goofed around for quite a while trying to get netatalk2.x working but it turns out that 3.0.1 Just Works. Now using 3.0.5

zlogin to the zone you have just installed and do the following:

pkgin -y install gcc-compiler-4.6.2   
pkgin -y install gmake-3.82nb3

# necessary for dhx2 authentiation - needed for modern macs

pkgin -y install libgcrypt-1.5.3

#One can use Apple's mDNSResponder
# 201309 - dbannister says this is unnecessary due to integrated mdns/bonjour
# in netatalk3, so don't bother. :)

pkgin -y install mDNSResponder-258.14
svcadm enable mdnsresponder

# the mdns software that is baked in is deficient
# as noted above.  it comes disabled by default in
# the non-global zone.  you probably don't want to enable it.
# it's called svc:/network/dns/multicast:default

mkdir build
cd build
wget http://sourceforge.net/projects/netatalk/files/netatalk/3.0.5/netatalk-3.0.5.tar.gz/download
tar xvfpz netatalk-3.0.5.tar.gz
cd netatalk-3.0.5
./configure  --disable-ddp --without-pam --with-ssl-dir=/opt/local --with-libgcrypt-dir=/opt/local --with-bdb=/opt/local prefix=/opt/local CFLAGS=-m64 CXXFLAGS=-m64 
make && make install

Now some setup…

useradd -c "Rob Seastrom" -s /usr/bin/bash rs
mkdir -p /home/rs/afp-data
chown -R rs /home/rs
passwd rs

useradd kimby
mkdir -p /home/kimby/afp-data
chown -R kimby /home/kimby
passwd kimby

mkdir -p /afp2/tm_backup
chown rs /afp2

afppasswd -c
afppasswd -a rs
afppasswd -a kimby

sample afp.conf:

[root@fb8ddf5d-b5e2-448b-a7c1-785f0e50d4e7 /opt/local/etc]# cat afp.conf
; Netatalk 3.x configuration file
; Global server settings
hostname = BlackBart
uam list = uams_dhx.so,uams_dhx2.so
save password = no

; [Homes]
; basedir regex = /xxxx

path = afp-data
basedir regex = /home

; [My AFP Volume]
; path = /path/to/volume

path = /afp2/tm_backup
time machine = yes
vol size limit = 350000

[root@fb8ddf5d-b5e2-448b-a7c1-785f0e50d4e7 /opt/local/etc]#

Add hostname (BlackBart) from above to /etc/hosts

Now make stuff start up properly the Solaris way:

cd /root/build/netatalk-3.0.1/distrib/initscripts
make netatalk.xml

edit netatalk.xml, change dependency on svc:/network/dns/multicast to svc:/network/dns/mdnsresponder

svccfg import netatalk.xml
svcadm enable netatalk