March 13, 2004
Stupid Symlink Tricks
by peterbI do all of my work on my laptop. I have an external drive for large projects, but the desire to keep everything on the laptop means that I really only want to spend internal hard drive space on the essentials.
I love LiveType, but I only use it once in a blue moon, generally when finishing a project up. Unfortunately, Apple's dopey installation program requires that LiveType (like all the Pro apps) be installed completely on the internal drive. Here's how to route around their bogosity.
All we're going to do is use the unix ability to have symbolic links from one directory to another allow us to store the most egregiously large directory on our external drive. Symbolic links are created with the ln command.
(I am assuming that your external drive is hooked up during this procedure. For instructional purposes, let's assume the drive is named external)
That's it! You're done. (You could of course just do sudo bash and then issue the mkdir, mv, and ln commands from a root shell, but that violates the principle of being conservative when wearing your root hat).
You can do this not only with LiveType, but with Soundtrack, and in fact even with iTunes, if you're willing to accept parts of your collection being unavailable when you're not tethered to your drive. Note that iTunes goes to greater lengths than most to disallow this technique (in particular, it will actually insist that your "iTunes Music" directory is on a local drive, but you can set up symlinks within that directory for specific artists. I have two little shell scripts to let me migrate data back and forth as I desire. Here's one:
...so from within my iTunes Music directory offline.sh "The Beatles" will migrate the entire Beatles directory to the external drive, and set up the correct symlinks so that I can still access it as needed. Of course, there's an online.sh to reverse the process.
One thing of note is that most of the HFS+ savvy applications hate symlinks and do unexpected things when asked to store data in a symlinked directory. So if after migrating data offline you try to add anything to those directories (for example, by ripping another Beatles album, say Let It Be in iTunes), it will end up sticking that in ~/Music/iTunes/iTunes Music/Let It Be rather than in ~/Music/iTunes/iTunes Music/Beatles/Let It Be. It still works, it's just unpleasant. This means that you should always be prepared to undo your symlinks before installing software updates, for example, lest you confuse the poor lost little Finder.
I hope this little trick helps you, and be sure to make backups of any unrecoverable data before trying it, lest a careless slip of the fingers (or a mistake on my part!) cause data loss.
I assume a more Mac-centric audience might not realize it; My first thought was to do it exactly this way, because duh, it's Unix.
Posted by Derrick Brashear at March 13, 2004 08:07 PMI have a couple of comments.
The BSD unix command line utils (like mv) don't understand HFS resource forks, so they are lost. For a single file, use CpMac. For a whole directory, use ditto (which preserves permissions as well as resource forks).
Within a volume, mv optimally moves only the directory entries for a file - the actual data remains in its original disk blocks (inodes). However moving across volumes forces the data to be copied, so your no better off than using ditto anyway. However, you can usually avoid the copy step by performing the link in advance of the installation. That forces the installer to put the files on the external device as they are un-archived.
One way to fool iTunes is to hard-mount another device into the filesystem at ~/Music/iTunes/iTunes Music. This is especially nice, because you can keep a small selection of songs on the laptop for when you are "untethered". The hard mount at that same directory would then "obscure" the local tunes. Ideally, you could mount using the 'union' option, but that would probably seriously confuse iTunes. man mount.
Posted by Brett Johnson at March 13, 2004 09:17 PMOf course, this is well covered in the manual on page 105 (from memory). A regular alias will work 99% of the time.
Cheers
Philip
Posted by Philip Hodgetts at May 29, 2004 09:18 PMPlease help support Tea Leaves by visiting our sponsors.