Understanding Hard Links

First signs of a problem

I copied my Movies directory from my old Mac to my new Mac, using target disk mode. On my old Mac, the Movies directory took up 84G. But on my new Mac, it took up 149G. What was going on?

My Movies directory contained hard links, which I wrote about last time.

The Movies directory contained 65G of files that were hard-linked to other files also within the Movies directory. When I copied them the usual way (by drag and drop, or cp), the hard linked files were copied one time for each hard link. So tons of duplication, tons of wasted space.

Investigating hard links

The command du, which calculates disk usage of a directory, is useful for understanding what hard links you have and where.

Continue reading “Understanding Hard Links”