ms at citd.de
Mon Nov 17 02:56:55 MST 2014
On 16.11.2014 18:38, Karl O. Pinc wrote:
> On 11/16/2014 03:53:12 PM, Joe wrote:
> > I have a lot of files (and directories) (up to a few hundred at a
> > time)
> > that I get from various sources. Some time after I get them (after
> > they
> > are already backed up), I often have to move them around and
> > normalize
> > their names.
> > When I do this, rsync sees them as unrelated to the copies of these
> > files which are already on the backup destination.
> I don't know if it suits your use case but
> you could consider using hardlinks.
It should be noted that using hardlinks has 1 major caveat:
It only saves a copy when the new hardlinks appears in the hierachy
AFTER the original file.
(This is true for "incremental"-mode (default for >=3.0). It might work
differently for <3.0 or "--no-inc-recursive"-mode, but i haven't tried.)
Otherwise rsync will copy the "new" file and later hard link the
"old"-file to the "new"-file and not the other way around.
So i personally use a directory '.z' in the root of a hierarchy where
each file has an additional hardlink, so i can move files around in the
hierarchy however i want.
That way rsync "see"s the '.z'-directory first and acts accordingly.
Such a directory can be created after the fact.
Make a directory that is LAST in sort-order. Assuming plain ASCII
Then link all files into that directory and rsync (Don't forged adding
Then rename it to be first in sort-order (on both sides!):
mv zzzzzzzzzzz .z
And after you have made the necessary changes to your procedures to make
the additonal hardlink you are free to move around files without rsync
having to copy them each time they are moved.
After deleting files you can use:
find .z -type f -links 1 -delete
to find and delete files that don't have an additional hardlink.
More information about the rsync