Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
2  
Of course it does. You use Mac OS to move the file, after all. :) –  grawity Apr 8 '11 at 15:38
1  
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
add comment

2 Answers

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
add comment

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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.