Hard linking to folders

Discussion in 'Mac Programming' started by mattrobs, Feb 4, 2009.

  1. mattrobs macrumors member

    Jun 10, 2008
    John Siracusa mentions that Time Machine does what it does because Leopard now allows hard linking to folders.

    How do I do that? I've tried the ln command with no options, but I get source Is a directory error.

  2. gnasher729 macrumors P6


    Nov 25, 2005
    You don't. Time Machine can do it because it does things under very controlled circumstances, and you can only create hard links on your backup drive by using Time Machine. The OS doesn't allow you to create hard links to directories in any other way.

    Being able to create hard links to directories would make it possible to create cycles between directories, causing all kinds of problems, possible or even likely creashes etc. imagine what happens if folder A is a hard link to folder B, and folder B is a hard link to folder A, and the Finder tries to display the contents of folder A.
  3. kylos macrumors 6502a


    Nov 8, 2002
    WRT Hard links

    I've been curious, I've been told to be ever so careful when dealing with hard links and multiple volumes. If I were to attempt to make a manual archive of Backups.backupdb on another volume using Finder, would I run into problems or will Finder properly handle the hard links when copying the files to a new volume?
  4. gnasher729 macrumors P6


    Nov 25, 2005
    The Finder wouldn't know the hard links are hard links. Every hour Time Machine creates what looks like a complete backup of your hard drive, but because of hard links, very little data is actually copied. If you copy any single one of those backups using the Finder, the result will be one complete set of data. Copy Backups.backupdb, and you end up with dozens of different copies of your hard drive, taken at different times.

Share This Page