Saturday, April 14, 2012

Use Ubuntu as Mac's File Server with Netatalk and Avahi

Like many of you, I need to share folders, time machine backup drive, and access to external DVD drive for my Mac machine. I have been using Ubuntu machine for many years with bunch of disks, share it to other machines.

I faced issues after upgrade my Mac to 10.7.x. Time Machine didn't work. I couldn't play DVD movies either. This problem is confirmed by Apple Support, they and suggest you to buy an expensive Super Drive.

This article is to help you solve those problems. The trick is to broadcast your Ubuntu server (announcing Netatalk AFP fileserver with Avahi) to Mac machines in the network automatically. So your Mac will see the Ubuntu server every time it's up, read shared folders, including time machine backup drive, and DVD sharing that you have setup in Ubuntu machine.

If you do something on the shared folders in Ubuntu, it will automatically tell your Mac. For example unmount/mount a shared disk or change CD/DVD. Mac and Ubuntu are finally a perfect match machines for you.

I use Ubuntu 11.04 LTS Natty Narwhal and Mac OSX Lion 10.7.3. I use latest Netatalk 2.2.2. But I think this should also work in newer version.

First thing to do is make sure you have setup Netatalk and Avahi properly in your Ubuntu machine. Second thing is optional, only if you also share DVD. Make sure you can see shared folder (and/or DVD drive) in your Ubuntu from Finder in your Mac.

If you haven't setup them, follow steps in this two blog spots: Share Folder in Ubuntu 11.04 for Mac OSX Lion, and Setup Shared DVD in Ubuntu for Mac OSX Lion.

After everything works then you can follow below simple additional steps.

Setup Avahi name server

Go to your Ubuntu machine, open terminal, edit hosts file using your favorite text editor (I use nano):

$ sudo nano /etc/avahi/hosts

Add the following line: Ubuntu-Server.local

My Ubuntu server name is Ubuntu-Server, change the name as your PC's name and IP address as what you have set in your Ubuntu machine. Always use .local domain for Mac OSX compatibility.

Create Avahi service

Now create a new Avahi service for your machine.

$ sudo nano /etc/avahi/services/Ubuntu-Server.service

Add the following code:

<?xml version=”1.0″ standalone=’no’?>
<!DOCTYPE service-group SYSTEM “avahi-service.dtd”>
<name>Ubuntu Server</name>
<service protocol=”ipv4″>

Restart Avahi service:

$ sudo service avahi-daemon restart

Go to your Mac and open Finder. You will see your Ubuntu Server automatically in Finder.

Additional tuning for DVD sharing

This step is only if your Mac is diskless or if you need to access shared DVD drive in Ubuntu machine.

One thing that I noticed after the setup is I found that Mac will complain that cnidb is not compatible and automatically change it to the default value. So let's change it a bit. Edit AppleVolumes.default file:

$ sudo nano /etc/netatalk/AppleVolumes.default

Find the line for DVD sharing and change cnidscheme parameter from dbd to last. Change macuser to the user you have setup in Ubuntu. The line will look like the below:

/media/dvd $v allow:macuser cnidscheme:last options:use dots,upriv

According to Netatalk documentation, this last option is no longer recommended as dbd is heavily used for CNID backends. But I found it is still very-very useful especially for CD/DVD sharing. Luckily the latest version of Netatalk still keep it there.

The only small problem is Remote Disc in Finder still cannot recognize the shared DVD. Actually this is not a real problem, as long as you can play music and movie, or any CD. Am I right?

Play Movies using DVD Player

Login to your Ubuntu Machine. Insert the DVD disc into DVD drive in your Ubuntu. Go to your Mac, open DVD Player from Applications in Finder. Wait for few seconds until the content is mounted in Finder. Click File, select Open DVD media (command O), select the Ubuntu-Server (or whatever is your server name), select the share DVD drive, click Choose.

Alternatively you can play movies using VLC. Similar steps as above, open VLC. From the menu bar click File, select Open Disc. From Open Source window select DVD radio button, click File tab, then click Browse button. Then select Ubuntu-Server, select the shared DVD drive, check "Treat as a pipe rather than as a file", then click Open button.

Now you can get rid of all hassles to get all you need for your Mac from a fileserver: shared folders, time machine backup drive, and the most fun is to enjoy DVD movies from your Mac.

Next additional step to make it works perfectly for you is to auto mount DVD drive so every time you change disc it will automatically also change the content from your Mac.

Share your experience, or tell me if you have better trick.

Announcing remote Netatalk AFP servers with Avahi
Share Folder in Ubuntu 11.04 for Mac OSX Lion
Setup Shared DVD in Ubuntu for Mac OSX Lion


Anonymous said...

Thanks for this nice article!

I used that for my remote time machine folder. It worked fine until I upgraded to Maverics. The time machine drive cannot be accessed anymore.

Any help would be appreciated.


Cornextorium said...

Hi Nelly,

I have no problem after upgrade to Mevericks, all works fine without having to change anything in the Netatalks.

Can you post what errors you encountered? Hope I can help.


Cornextorium said...

A useful link to setup Time Machine on a network drive. Also works once you setup your network drive using the above article.

Anonymous said...

Hello there! I could have sworn I've been to this blog before but after browsing
through some of the post I realized it's new to me.
Nonetheless, I'm definitely happy I found it and I'll be bookmarking
and checking back frequently!

my site - forbrukslÄn ()

Anonymous said...

This article is truly a fastidious one it assists new the web visitors, who are wishing for blogging.

Look into my web page beste ForbrukslÄN

Anonymous said...

Hello, after reading this awesome paragraph i am as well happy to share
my knowledge here with colleagues.

Feel free to surf to my web site: paper converting

Anonymous said...

  However, if you sign out of the chat before other users do,
only the part of the Group Chat that you participated in will be saved.

Generally , people use text to communicate but, it is no longer just text that is
used; it has become a multimedia affair. Featuring
bits on writing, writers, books, and literature, Lit Bit
will fulfill your literary longings.

My site - dating chat

Akmos17 said...

If you do something on the shared folders in Ubuntu, it will automatically tell your Mac. For example unmount/mount a shared disk or change CD/DVD. Mac and Ubuntu are finally a perfect match machines for you.backup software

Anonymous said...

UGG Boots Michael Kors Outlet Stores () Marc Jacobs Outlet ( Chanel Handbags Michael Kors Outlet Stores Cheap Uggs Boots; ,
The North Face Outlet Canada Goose
Jackets ( Toms Outlet Store Ray Ban Sunglasses
Toms Outlet Store ( Michael Kors Outlet Online; , Oakley Sunglasses ( Christian Louboutin Shoes ( The North Face michael Kors outlet Christian Louboutin Outlet Michael Kors Handbags Outlet ( CHI Flat
Iron Website () Michael Kors Outlet Online (
Michael Kors Outlet -, Michael Kors Handbags jimmy choo shoes online Kevin Durant Shoes ( Christian Louboutin Outlet Online (
Louis Vuitton Handbags Outlet Louis Vuitton Outlet Online Store Canada Goose Jackets Sale Celine Bag CHI Flat Iron Website

Torie Young said...

There are so many useful information in your post, I like it all the time. And I want to share this what is aso with you,you can take a look. This is very useful.

HPE6-A41 braindumps said...

An interesting discussion is definitely worth comment. I believe that you should publish more on this issue, it might not be a taboo matter but typically people do not speak about these issues. To the next!