Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Maybe it's just me, but it seems like Mac OS knows where a file is even when it's moved. Does anybody know why this is?

share|improve this question
Of course it does. You use Mac OS to move the file, after all. :) – grawity Apr 8 '11 at 15:38
There are several ways to interpret this question. My answer to a question on Unix.SE is responsive to one of them, as it discusses the internals of traditional unix filesystems (which---tobylane notes below---HFS+ shares). – dmckee Apr 8 '11 at 17:13
up vote 5 down vote accepted

In addition to the file's path, Mac OS aliases record several pieces of additional information: the file's unique ID, its parent directory ID, file size, [possibly creation time]; which are used to locate the most probable match in case of a broken link. I think most of the time a file is found by its unique ID, which does not change after a rename.

See also Alias (Mac OS) on Wikipedia.

share|improve this answer
By the way, Windows is able to fix broken shortcuts in a very similar way (using an unique ID first, the file's timestamps and size if the ID lookup fails). – grawity Apr 8 '11 at 15:43

The Mac file system is called HFS+. It uses inode numbers in a B-tree, with the physical and logical location (three parts in total). Metadata is in another b-tree, along with the data-forks.

So it knows what to expect in a place, knows of another way to refer to it, looks that up and there you go. It's like if someone moved house, you still have their mobile phone number to call.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .