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.

I've been reading up on how OS X Time Machine works. Appearantly it creates hard links for directories as well. I'd imagine directories could just be created and only files could be hard linked.

Is there a good reason to create directory hardlinks? Better space efficiency? Time efficiency?

share|improve this question

1 Answer 1

up vote 4 down vote accepted

Time Machine uses the File System Events Database if possible to determine what files were changed since the latest backup. So it already has a list of what was changed.

In the default configuration, Time Machine backs up your files several times a day. In regular computer usage patterns, very few directories' contents are changed during this time. Being able to just add a single hard link for an unmodified directory tree saves quite some time and space otherwise used for creating directories and hard-linking files.

Regarding time: You can view the number of files and folders on your disk in Disk Utility. On my 240GB SSD, I have about 356,000 folders and 1.9 million files. Without directory hard links, Time Machine would need to traverse all of these either on the internal disk or in the folder of the previous backup to create all hard links, which would probably increase the time it took to create what is effectively a tiny backup.

Regarding space: Directories need to be stored on disk as well. Without directory hard links, every backup generation would need to consistent of the same ~350k directories. This can easily amount to a few gigabytes in size for the structures alone.

share|improve this answer

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.