cp -al issues

Wayne Davison wayned at samba.org
Tue Apr 13 00:30:22 GMT 2004

On Mon, Apr 12, 2004 at 10:18:53AM -0500, Max Kipness wrote:
> It seems there may be links breaking or something.

As I would expect -- all the files that get updated become uniquely
linked.  Without that, you wouldn't have any backups in the older dirs.

> Sometimes the /backup directory will end up holding only around 200mb of
> data, and one of the date directories will end up holding the bulk of
> the 37GB, should this happen?

Sure, it just depends on which directory du scans first.  Remember that
both hierarchies are entirely equal in the eyes of the file-system --
there is no concept of one dir really holding the data and the other
dirs just having hard-links (that's the way soft-links work).  With
hard-links, both hierarchies have the exact same links to the exact
same data (until a link gets broken by an update).

> on the second day 4-8-2004 now has changed to 9.1Gb and Current is
> only 29Gb??

I won't try to guess why Current is getting smaller, but having the
older dirs get more and more unique content is to be expected as updates

> Would there be any difference using --link-destination in rsync and not
> using cp at all?

You could accomplish the same thing without having to use cp.  If you
dumped the Current dir, you could just do a copy like this to create a
new 4-11-2004 directory based on the source information and the already-
existing 4-10-2004 dir:

rsync -a --link-dest=$PWD/4-10-2004 srchost:/path/ 4-11-2004

Rsync would create the new dir (4-11-2004) and all unchanged content
would be hard-linked to the content in the 4-10-2004 hierarchy.


More information about the rsync mailing list