Filesystem Layout

by Chad Whitacre last modified Dec 30, 2008 03:04 PM
With a little work you can make yourself right at home.
Apple does not adhere to any kind of standard or tradition in laying out the filesystem, so some work has to be done in order to make the box comfortable. In this particular box we had a drive for the system, and a RAID volume[8] for data at '/Volumes/Zope/'. I chose to link this from '/usr/local/zope', and I did the Zope installation and created a Zope instance using this more conventional path. I also made Apple's Apache setup a little more comfortable by adding a link from '/usr/local/apache' to '/etc/httpd/' (even though Apache isn't actually local on this box—it's part of the base system). The latter is the default location, and is actually itself a link to '/private/etc/httpd/'.[9] However, I didn't use my link in any scripts, but purely as a convenience while logged in. I decided to leave Apple's rc.d implementation alone. Adding our configuration there was really a one-time shot, and it came at the end of the project when things were rushed. Therefore, the relevant parts of my final filesystem layout looked like this:
/Library/StartupItems/Zope
/usr/local/apache -> /etc/httpd/
/usr/local/zope -> /Volumes/Zope/
/usr/local/zope/2.7.3
/usr/local/zope/htdocs
/usr/local/zope/instance
The most paranoid among you will want to avoid using symlinks. However, I believe this is fairly standard practice. And in fact, upgrading is much easier if, for example, you link from zope/2.7.3 to zope/zope, and use that to make your instance. The same could/should be done with your python interpreter. This, however, is not an OS X-specific topic, and is better dealt with in detail elsewhere. And on that note, "let's wrap this up":conclusion.
Notes [8] We used Apple's built-in software RAID, which only supports RAIDs 0 and 1. Apple RAID is managed with the Disk Utility (Applications > Utilities > Disk Utility). The nav is a little goofy, but once I figured it out the actual config went fine. [9] I learned a hard lesson here: in trying to remove this symlink I accidentally removed the httpd directory! If you include the trailing slash when referring to a link that points to a directory, then you are actually referring to the source directory itself. Whatever version of bash was installed gave me the trailing slash on the first tab-completion, and well, it was late, and I eventually added a '-r' to the 'rm'! I spent the whole next morning on-site reinstalling Apache (it's on Disc 2, part of Server Essentials ;^) ). Of course, since I was just trying to rename the link I should have used 'mv' in the first place. And *that*, boys and girls, is how we learn Unix!