More Reviews




Final Cut Pro X - Hard Links and Symlinks

January, 2015

Final Cut Pro X - Hard Links and Symlinks

By Richard Taylor

I’ve seen hard links discussed in reference to Final Cut Pro X recently. I wanted to find out more about what hard links are so I dove into the shallow end of the online UNIX swimming pool. On the surface they are not that complicated. In this article, I've tried to keep the explanations as simple, non-technical and as clear as possible.

Symlinks versus hard links.

A symbolic link (also known as symlink or soft link) is a special type of file containing a filesystem path to another file or directory. The symlink is a second file that exists independently of its target. If a symlink is deleted, its target remains unaffected. If a symlink's target is moved, renamed or deleted, the symlink is not automatically updated or deleted. It continues to exist and still points to the old target.

A symlink is not a direct link to a file.

Hard Links
When you make a file in Mac OS X, you give that file a name. This file's name, stored in the directory, is not a separate file like a symlink is. It is possible to create a number of different names that all refer to that same file. Those names are hard links. Technically a hard link is a directory entry that associates a name with a file on a file system. To put it another way, hard links are any name(s) assigned to a single file.

As an analogy, hard links are like different names by which one person might be called. Say Person X has Bob as his first name and Thomas, as his middle name.

Some people call Person X "Bob", (his workmates) and some call him "Thomas" (his family, to avoid confusion since his father was also named Bob). Both names, Bob and Thomas, refer to one person.

Caution! Technical stuff you don't really need to know follows.
All hard links actually point to a single inode number (index node number). An inode number is a data structure used to represent a filesystem object. Each inode stores the attributes and disk block location(s) of the filesystem object's data. In other words, an inode keeps track of where the data of a given file lives on a hard drive and the attributes of that data.

There is no "real" name versus hard link name. All hard links are equally valid names for the file. If you had a name plus two hard links assigned to a single file, they would all link to the same unique inode number and file. When you delete a file in the Finder, you are actually just deleting the file's name in the directory and not the file itself. That's why data can usually be recovered from a hard drive when you "delete" a file.

Since both the original name and any hard links actually point to one single file, each name will reflect the entire amount of data in that single file. But the total amount of data the file and associated hard links actually use on a disk will be the amount of data in the single file. The total is not the sum of every name or hard link's referenced data.

You can delete the original name given to a file on creation and if a hard link exists, the file still exists. If the file is opened by one of its names, and changes are made to its content, these changes will be reflected when the file is opened by an alternative name.

For those who use Terminal, you can make a hard link using the Terminal command ln original newname where "ln" is the hard link command, "original" is the existing file name and "newname" is the new name for the hard link.

Similarly, you make a symlink by using the Terminal command ln -s original symlink where "original" is the existing file name and "symlink" is the symlink. I make symlinks with PathFinder.

You don't have to make hard links or symlinks though. Final Cut Pro X (and Time Machine for that matter) handles that automatically when it is needed during media management operations.

Indianna University

Richard Taylor is an Editor/Producer and a Level 2 Apple Certified Trainer for Final Cut Pro X from the Washington DC/Baltimore Maryland area. He can be reached via his Final Cut Pro X website FCPX.TV or on Twitter @RichardTaylorTV

Copyright © 2015 Richard Taylor. All rights reserved.
Apple and Final Cut Pro X are registered trademarks of Apple Inc

copyright © lacpug LLC 2000-2015 All rights reserved