Mounting external HDD in Mac OS X from Ubuntu system

3

I have a 3TB HDD that is connected to my Ubuntu desktop via USB. How can I mount it (the USB HDD) as a drive on my Mac OS X machine over my network while it's still connected to the Ubuntu machine?

Part of why I'm trying to do this is because I had a previous external 'crap out' on me (OS X suddenly stopped recognizing it; Ubuntu can read it but due to the way OS X partitioned it for Time Machine Ubuntu can't write to it). Is there any formatting I can use so that (ignoring the question above) if I ever wanted to connect it directly to the OS X machine both systems can read and write to it fine?

user3064209

Posted 2014-10-05T23:54:13.837

Reputation: 33

Answers

0

So basically you want the Ubuntu system to share the 3TB USB drive with your Mac, correct? Then your best bet is to use Netatalk to setup an AFP compatible share point on your Ubuntu box. The details below are culled from my personal cheatsteet for setup on Ubuntu 12.04; I doubt there are any major differences in other versions since variants of this concept have been used for years on various Linux systems. But I would recommend checking this site as well as this site and this other site for other bits of info.

For starters, install Netatalk using an package installer—such as aptitude—like this:

sudo aptitude install netatalk

If you are using Mac OS X 10.7 (Lion) or above, then you need to adjust the config. First open it up using whatever your favorite text editing tool is; I prefer nano:

sudo nano /etc/netatalk/afpd.conf

Then add this line to the bottom of the file:

- -tcp -noddp -uamlist uams_dhx.so,uams_dhx2_passwd.so -nosavepassword

With that done, you can now add your external USB drive as a volume accessible via AFP by editing the AppleVolumes.default:

sudo nano /etc/netatalk/AppleVolumes.default

And add a line like this to the file:

/path/to/usb/external/drive "My Great 3TB Drive" allow:root options:usedots,upriv,noadouble

The easy way to parse that line is:

  • The first thing is the file path you wish to share.
  • The next is the name of that share that will be used.
  • Next up is allow: which lists who you would like to allow access to the share.
  • And finally we have options: which might be the place you spend your most time tweaking. The combo I list there works well for my purposes. Look at this page and search for options: to see what options exist.

If you want to constrain access to a group—rather than a specific user—then set the allow: to allow:@groupname so the line would be something like this:

/path/to/usb/external/drive "My Great 3TB Drive" allow:@groupname options:usedots,upriv,noadouble

Then just restart the netatalk service like this:

sudo service netatalk restart

And if you connect to the Ubuntu machine via AFP with an address like this; assuming your Ubuntu address is 10.0.1.2:

afp://10.0.1.2

Then you will get a list of available shares. One of them should be My Great 3TB Drive as you have setup above. And you should be in business.

But to make your live easier you might want to instal the Avahi daemon service which is basically an open source implementation of multi-cast broadcasting like Apple’s Bonjour:

sudo aptitude install avahi-daemon avahi-utils

And to setup the AFP service as being accessible via Avahi, edit this file:

sudo nano /etc/avahi/services/afpd.service

And place this XML into it:

<?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>

Then restart Avahi like this:

sudo service avahi-daemon restart

And now the shares should be visible in your Mac server list like any other Mac/machine sharing via AFP! The system name shown should be the same as your Ubuntu machine’s hostname.

Now, a bonus thing: Look at the XML entry for model=:

<txt-record>model=Xserve</txt-record>

I have that set to utilize an Xserve icon as default. But you can basically change that to match whatever system icon you wish to associate to your Ubuntu machine. You can poke around in /System/Library/CoreServices/CoreTypes.bundle/Contents/Info.plist to see what icons the system has in place to adjust the icon icon to your liking; hat-tip to Simon Wheatly for this tip. So you can change your <txt-record>model=[something]</txt-record> to match items such as:

  • Macmini
  • iMac G5
  • RackMac
  • Xserve

And so on.

EDIT: Also, your “bonus” question is if there is a way to share an external drive between Mac OS X as Linux without network sharing. Meaning just mounting the drive as a drive on whatever machine you want. Well, it’s my understanding that modern Linux machines can read & write to HFS Plus partitions, but “Journaling” must be disabled. I have not tried this out myself, but experiment with disabling “Journaling” on the drive & see what happens.

JakeGould

Posted 2014-10-05T23:54:13.837

Reputation: 38 217

thanks! I'll give all that a shot sometime this week and respond here with how it works, much appreciated! :) – user3064209 – 2014-10-06T02:30:03.520

@user3064209 No problem. And if it matters, I have set this stuff up on Ubuntu 11.04 and 12.04. While this answer is detailed, I believe it should be a straight-forward process when you find the time to sit down & focus on this. – JakeGould – 2014-10-06T02:32:11.550