So I've discovered Apple's mystical implementation of hard linking with the new Photos app library and the old iPhoto library. Although Finder reports that both take up a significant and similar number of GBs on the disk space, they apparently are pointing to the same data on my disk, so data hasn't been duplicated.

Question is, how can I verify this? If I check the size of the parent folder, it's also reporting double GB. I imagine I can check all the folders at the root level and find that the total adds up to more than what I have based on free space... but that doesn't actually pinpoint what files are hard linking.


Hard linked files share the same inode (which kind of identifies the file in the filesystem). So what you can do is to get the path of two photos which should be the same ("Reveal in Finder" in the old application, probably something similar in the new), open Terminal and run

ls -li /path/from/old/app.jpg /path/from/new/app.jpg

to see whether the number is really the same.

  • Nice, that's a clean proof
    – andrewb
    May 5 '15 at 12:25

You can check for hard links by selecting either the folder [possibly a bit excessive] or one sample file…

You can access the contents of a Library file [which is really a folder] by right clicking it & selecting 'Show Package Contents'.
Be careful not to actually play around in there, Apple would rather you didn't ;-) but looking through the folder hierarchy won't in itself break anything. Masters would be the ideal folder to check in.

Launch Terminal & type ls -l then drop your sample file onto the window - that will insert the correct path.

Any file that reports a 2 (or more) in the value after the permissions -rw-rw-rw-@ section is hard linked with 2 references.

An example -

enter image description here

  • Ah nice! Though I'd imagine that'd be more for answering the question "is my photos library hard linked elsewhere" rather than "is A hard linking to the same data as B?". My folders seem to have quite a few links, e.g. 11, do you know what that's about?
    – andrewb
    May 5 '15 at 12:26
  • 1
    I don't, tbh - patrix's answer is probably more use than mine for anything other than 'do 2 links exist?'
    – Tetsujin
    May 5 '15 at 12:37
  • I could see it actually being useful for a disk usage interface. Currently I look through at total size to motivate me to delete files, but if I were to see that a file is one of many that reference a single "inode", then it may hamper my eagerness to delete it.
    – andrewb
    May 5 '15 at 12:43
  • someone far smarter than me might be able to come up with a grep to isolate files with only 1 node
    – Tetsujin
    May 5 '15 at 13:17
  • folders have .. and . folders which link back to the parent folder and the folder itself respectively. I'm not certain about . but .. is a hard link, so every folder gets an additional hard link for each folder it contains. May 5 '15 at 15:02

You must log in to answer this question.

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