Mac OSX

This page is intended to offer some guidance to Mac users. The DNS-323 natively supports SAMBA (Windows) shares and so technically this means it supports Mac users, but there are a few things that you can do to make your lives a little easier!

NOTE: There have been a lot of complaints about SMB access since Snow Leopard. There seems to be some confusion about TCP ports for SMB file shares, but if you're explicit when you try to connect that may solve your problem. From the Finder, CMD+K pops up the 'Connect to Server' dialogue where you can enter the share name, or IP address of the server. For the DNS-323, using SMB from a Snow Leopard Mac, use something like ”smb://192.168.99.99:139”, or ”smb://mydns323:139”.

SAMBA vs. AFP

Although SAMBA typically takes a lot of flack from Mac users, if correctly configured, the DNS-323 will play nicely. The biggest problem seems to be the lack of native mDNS support. Initially, I found the DNS-323 SAMBA mount points to be extremely slow and cumbersome in OSX compared to Windows XP. Connecting to a share (either manually in Finder via the “Go” menu, or by clicking on it under “Shared”) was painstakingly slow.

I configured AFP using Fonz' Fun-plug 0.5, and found it really snappy, but the problem remained that there was no easy way to simply select the NAS under the “Shared” section in Finder, and establish a connection via AFP. Connecting via “Go” → “Connect to server” was quick, but if I tried to browse under the “Shared” section, Finder would hang, then connect via SAMBA. I discovered that the trick was to correctly configure AVAHI/mDNS/zeroconf/Bonjour on the NAS. As soon as I did so, the differences between SAMBA and AFP were unnoticeable (at least to me).


An easier option is to modify the SAMBA settings on the DNS-323:

Slow SAMBA access from OSX can be fixed by adding a single line to the DNS-323 smb.conf file and restarting SAMBA. This can easily be accomplished with the following fun_plug:

#!/bin/sh
# switch to safe working directory on ramdisk
 
cd /
 
# if no samba config file, then copy the current document to Volume_1
# otherwise, copy the user samba config file and restart samba
 
# original code on this post, -x tests for smb.conf to be executable.  -e checks for file existance
#if [ -x /mnt/HD_a2/smb.conf ]; then
 
if [ -e /mnt/HD_a2/smb.conf ]; then
	cp /mnt/HD_a2/smb.conf /etc/samba/smb.conf
	smb restart
else
	cp /etc/samba/smb.conf /mnt/HD_a2/smb.conf
fi

After creating the fun_plug and restarting the DNS-323, you will find a copy of the smb.conf file on your Volume_1 share. You can then modify the configuration file and restart once more to apply the settings. (Note that it takes about 30 seconds longer to complete a restart because SAMBA must start up twice.)

The important setting to add in the [ global ] section is the following:

large readwrite = no

Add the setting to the beginning of the smb.conf file with Textedit so it begins like this:

[ global ]
large readwrite = no
interfaces = egiga0
unix charset = UTF8
workgroup = workgroup
... etc ...

After modifying the smb.conf file this way and restarting, you should see file transfer speeds between 18 and 23 MB/s, which is the maximum speed of the DNS-323.

If you know what you are doing, you can make more changes to the smb.conf file. For instance, I have changed the names of the shared volumes because I have two DNS-323s and identical volume names can confuse the Finder in OSX.

The additional benefit of modifying SAMBA this way rather than installing the Fonz Fun-plug is that the Linux system has not been modified and you do not run the risk of damaging your file system when restarting the DNS-323 because you are not running Linux from the hard disk which prevents proper unmounting of the drive.

Adding Bonjour support to the DNS-323

The easiest way to proceed is to install optware, then download and configure the avahi package. Although the process really isn't that complicated, there are a few gotchas which I will attempt to explain. Here are the steps to configure Avahi (the Linux Zeroconf implementation of Apple's Bonjour).

  • Install FFP 0.5. Basically, download fun_plug and fun_plug.tgz from the following site and copy them to “Volume_1” of the DNS-323, then reboot. FFP 0.5 installs itself and you can telnet in.
  • Here are the instructions for installing FFP and configuring SSH (http://dns323.kood.org/howto:ffp)
  • Install optware, following these instructions: (http://dns323.kood.org/howto:optware)
  • The optware startup script specified on the optware how-to page works, you just need to comment out the lines that echo details to the log. They really serve no purpose. If you want them, just specify the LOGFILE variable at the top of the script. You can't skip this step… it ties /opt to your ipkg opt directory.
  • Be sure to add the path directive from the script to the /ffp/etc/profile file, since we installed FFP 0.5. If you don't, you'll have to manually locate “ipkg” as well as all of the other binaries that you install under /mnt/HD_a2/opt/.
  • Install the avahi package (ipkg install avahi).
  • Next you need to create a few groups/users for dbus and avahi to correctly function. Create the following groups, using the “groupadd” command:
groupadd avahi
groupadd messagebus
groupadd netdev
  • Now create the following users:
adduser -S -G avahi -D -H avahi
adduser -S -G messagebus -D -H messagebus
  • Next, edit the /etc/group file to add the 'messagebus' and 'avahi' users to the 'netdev' group that you created above. The line should look like this after your change:
netdev:x:3:messagebus,avahi
  • Alternatively you can use the addgroup app to add avahi and messagebus to the netdev groups:
addgroup messagebus netdev
addgroup avahi netdev
  • Save the modifications to /etc/passwd and /etc/group to flash, so that they are persistent, after you reboot:
store-passwd.sh
  • Now you need to add one or more Avahi services.
  • Change into the /opt/etc/avahi/services directory. You will see two existing files; one for ssh and one for sftp. You'll want to create one for your SAMBA shares, and possibly one for AFP (if you've installed the AFP module for FFP 0.5 or via optware.)
  • The SAMBA file that you create (call it smb.service) looks like this:
<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<service-group>
	<name replace-wildcards="yes">%h (Windows)</name>
	<service>
		<type>_smb._tcp</type>
		<port>139</port>
	</service>
</service-group>
  • If you create an AFP service, call it afp.service and it should contain the following:
<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
	<name replace-wildcards="yes">%h (Mac)</name>
	<service>
		<type>_afpovertcp._tcp</type>
		<port>548</port>
	</service>
</service-group>
  • Note that you can rename the service as you see fit, by changing the <name …> tag from ”%h (Mac)” or what have you, to whatever you like.
  • Next you need to create a script to start dbus and avahi. I actually just added a couple of lines to the optware script that I put in /ffp/start (the one the ties /mnt/HD_a2/ipkg/opt to my /opt folder), back when I installed optware. Here is what I added:
# Start-up DBUS
rm -rf /opt/var/run/dbus/*
/opt/etc/init.d/S20dbus start

# Start avahi-daemon
/opt/sbin/avahi-daemon -D
  • Note that the rm command deletes the PID for the previously running instance of dbus (in the event that you shutdown or reboot) since the shutdown routine does not correctly remove the PID and socket files itself. If you omit this command, the first time you reboot, or try to restart dbus, it will fail because there is an existing PID, making it think it is already running.
  • Afer the script starts dbus, it starts avahi and loads your service files.
  • This SHOULD be all that you need to do. At this point if you run a “ps” from the console, you should see both dbus and avahi running (it will specify the avahi hostname in brackets).
  • If you can't see the processes, try executing ”/opt/etc/init,d.S20dbus start”, and “avahi-daemon” manually to see if there are some errors.
  • So, if everything worked, now when you open Finder in OSX, you should see a line under “Shared” for each service that you created. If you click on the AFP service, it will try to connect via AFP and you can choose “connect as” to specify a user/pass combo. If you click on the SAMBA service, it should immediately connect via SAMBA and/or let you click “connect as” to specify your Network Access credentials. The key here is that the delay is gone, because the SMB and AFP services are explicitly defined :)

Time Machine backups to SMB shares (no hacks required!)

Although Time Machine doesn't have any interest in using one of your AFP shares for a backup drive, it will automatically let you choose to use one of your SAMBA mounts, once you've installed and configured Avahi/Bonjour.

Basically, if your Avahi-advertised SAMBA mount is now appearing in Finder, under “Shared”, you'll also be able to just pop open Time Machine and choose that share for the backups (no hacks, no tricking it into thinking it's supported when it's not, or any of the other issues you run into for the netatalk AFP shares.

Comment: I haven't got it working with my MacBook.

ADDED 7/11/2009 ** Comment: It's working great on mine. You need to create the sparse bundle image on your Mac first and then move it over to the share. There are plenty of resources out there to get this done: http://www.horto.ca/?p=12 This page will get you doing the backups OK. In order to make life easy on you, put the sparsebundle in the root of the volume.

In order for you to make your backups visible when booting up from the MacOSX DVD to do a bare-metal restore, you must install and configure AFP, which is done from the How-To:AppleTalk on this page. You don't need to configure “atalkd” which is the AppleTalk protocol, you DO need “afpd” which is the AFP daemon. You will also need to edit the AppleVolumes.default file to add the root of your volume from the DNS-323.

Once you have AFP working you can then boot up from the MacOSX DVD and connect to your network (I plug my MacBook into my wired network because a wireless restore is too slow.) and then optionally configure your jumbo frames if you have them “ifconfig en0 mtu 9000” and then run the command to mount your AFP TimeMachine volume:

mkdir /Volumes/TimeMachine
mount -t afp afp://ftpuser:password@ipaddressofdns-323/Sharename /Volumes/TimeMachine

Once you do this you go into “Utilities > Restore System from Backup” and the TimeMachine backup is available as a restore source. Note: The MacOSX Install DVD DOES NOT have the smb library installed, therefore it is not possible to connect to an smb share…

I was able to successfully restore to an external USB drive and boot from it by holding down the option key. From there I was able to launch iTunes, iPhoto and check my files and folders to give me a degree of confidence that this was indeed a good restore. Only negative is that when you backup again, after doing a restore, Time Machine wants to do a full backup again which takes hours…


Navigation

Personal Tools