Time Machine does not preserve hard links in it's snapshots

Originator:ddribin
Number:rdar://7569890 Date Originated:22-Jan-2010 11:58 AM
Status:Open Resolved:
Product:Mac OS X Product Version:10.6.2/10C540
Classification:Other Bug Reproducible:Always
 
22-Jan-2010 11:58 AM Dave Dribin:
Summary: 
Time Machine does not preserve hard links in it's snapshots.  Thus, a file that is hard linked in the source volume takes up more space in the snapshot, as each hard link becomes a real file.

Steps to Reproduce:

1) Create a new file, then create hard and soft links to it:

% touch aaa.txt
% ln -s aaa.txt bbb.txt
% ln aaa.txt ccc.txt

2) Start a Time Machine backup

Expected Results:
The files aaa.txt and ccc.txt should be hard links in the Time Machine snapshots.

Actual Results:
They are each their own file:

% pwd
/Users/dave/work/scratch
% ls -l
total 24
-rw-r--r--  2 dave  staff  -   20B Jan 22 11:31 aaa.txt
lrwxr-xr-x  1 dave  staff  -    7B Jan 22 11:32 bbb.txt@ -> aaa.txt
-rw-r--r--  2 dave  staff  -   20B Jan 22 11:31 ccc.txt


% pwd
/Volumes/Time Machine/Backups.backupdb/fuji/Latest/fuji_10_6/Users/dave/work/scratch
% ls -l   
total 24
-rw-r--r--@ 1 dave  staff    20B Jan 22 11:31 aaa.txt
lrwxr-xr-x+ 1 dave  staff     7B Jan 22 11:32 bbb.txt@ -> aaa.txt
-rw-r--r--@ 1 dave  staff    20B Jan 22 11:31 ccc.txt


Regression:
Leopard and Snow Leopard behave the same.

Notes:
I use the rsync command with the --link-dest option to backup files from a remote Linux server.  --link-dest uses hard links so I can keep multiple backups while saving space.  If I include these backups in my Time Machine backup, the hard links explode the size of the backups. Furthermore, Time Machine does not take this exploded size into consideration.  For example, Time Machine will clear out enough space for a snapshot, and then fail as it runs out of space during the backup.

Here's the documentation for --link-dest from the rsync(1) man page: 

       --link-dest=DIR
              This  option  behaves  like --copy-dest, but unchanged files are
              hard linked from DIR to the destination  directory.   The  files
              must be identical in all preserved attributes (e.g. permissions,
              possibly  ownership)  in  order  for  the  files  to  be  linked
              together.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!