Create a Symlink (Alias)

Symlinks are like an alias and work in a similar way. Most uses of symlinks in Mac OS X will form around the idea of wanting to store something in a different place than is expected by the system.
The example that I am going to use in this case is the files used by Software Update Server found on Mac OS x Server. These files can take up a huge amount of space and you may only have a small system drive on your server with a large raid for all your data. Software Update Server downloads every update made available by Apples software update utility and allows them to be stored locally on your server and make these updates available to all your local clients. This is a very efficient way to apply updates to all your clients with the files only being downloaded from the internet once. The problem is these files can be in excess of 20GB in size. With this in mind storing these on a raid makes more sense.
Mac OS X Server expects the files to be located at the following:-
/usr/local/swupd
Lets say we have an external raid called “Raid”. Moving the files to the external volume could look something like this:-
cd /usr/local
mv -Rp swupd /Volumes/Raid/
Now that your files have been copied to the external volume we now need to create a link form the old location to the new location. We would achieve this by doing the following. I will break it down after:-
ln -s /Volumes/Raid/swupd/ swupd
So in this command the “ls -s” is what is creating the sym link. The next part tells it where to look e.g. “/Volumes/Raid/swupd” and the the last part “swupd” tells it what it should be expecting e.g. the name of the original file. It’s a little backward but it works. To check and confirm this in a more logical way type:-
ls -la | more
This will list the results page by page with a little more information than a standard “ls” but you should see:-
swupd -> /Volumes/Data/swupd/
We can now logically see the flow and we know where all information will go to. As Software Update Server downloads new files they will now be placed on to the external volume. Likewise if a client machine tries to access one of the stored files it will now pick up the files from the same place.


The location of the swupd bits looks to have changed under snow leopard server. Instead of /usr/local/swupd for the store sus settings give you a choice but defaults to /private/var/db/swupd