Mounting Mac Shares under Linux
Mounting Mac Shares under Linux - My tale of a ridiculously complicated way of running a development server, or, Don't Do This.
It all started two years ago. I wanted to run my development server under linux so it nearly (if not completely) matches the environment on the production server. I ended up using virtual machines (vmware) to run linux on, but all my tools reside on my mac.
This may not seem like a huge problem, just export a share from the linux machine and mount it on the mac. As Gordon Ramsay would say, "Mounting file share on a mac... Done."
However there are problems that arise from this setup. Like a prairie bison... no, let's skip the metaphors. Here's the scoop. When I tried using Subversion on a network share - shared from linux, mounted on my mac - it almost worked. In fact, it almost worked so well that I kept thinking I was close to figuring out what was going wrong.
I put nearly two years into trying to figure this out, little by little, a few hours here and there. Each time it ended in failure. I have come to a conclusion, ready for this? This simply isn't possible.
Subversion hates this setup. It needs direct file system access because it needs to fiddle around with permissions and whatnot (can't remember specifics right now, but trust me it doesn't work).
So the solution I've come up with is to reverse this. I'm using samba (smb) to share my folder from my mac, where it is part of the native/physical file system. I'm using /etc/fstab on my linux virtual machine to mount the mac share onto my htdocs directory.
//172.16.170.2/htdocs /opt/lampp/htdocs smbfs username=[your mac username], password=[your mac password],uid=www-data,gid=www-data
Just make sure to put it all on one line, no spaces between the commas, and replace the IP address and other bits with your info. Remember the IP address is the address of your mac or (shudder) pc
The uid and gid might need to be changed - these need to be the linux user and group apache is expecting the files to be owned by.
You can test it out immediately by using the mount command. In this case, because the mount point is /opt/lampp/htdocs, we would issue this command
mount /opt/lampp/htdocs
This is also handy if you turn off file sharing (when you're traveling, for example). When you turn file sharing back on, no need to reboot your virtual (or non virtual) machine, just use the mount command shown above.
An additional note, if you do turn off file sharing on your mac, when you do turn it back on, you will need to go into the options and turn smb sharing back on. (see picture below)

I should not have to tell you this is no way to run a production server. Yet, it has been, and continues to be, a great way to run a development server. All my gui tools are located on my mac, all the server stuff is running under linux which is very similar to my production server. Subversion is happy with this as all the files are local to my mac's file system.
I hope this short article proves to be useful to you. Please email any comments to tim@tgwebsolutions.com - I'll post any interesting or useful ones on this page.
