Issue with hard links, please help!

Max Kipness max at
Thu May 11 14:43:04 GMT 2006


Sometimes when creating hard links to the rsync destination directory,
it seems like the new directory (created from the cp -al command) ends
up with all the data. This causes a problem in the sense that if the
rsync destination directory had 21GB, after the cp -al command, it ends
up having only 8mb, then the rsync source directory determines that it
now requires 21.98GB to update the destination directory.

Here is an example of a test that I was doing. I have no idea why
sometimes it works like it should, and sometimes it doesn't. My
destination directory is called 'Latest'.

 [root at backup backup]# du --max-depth=1 -h
21G     ./Latest
21G     .
[root at backup backup]# cp -al Latest/ ktest/
[root at backup backup]# du --max-depth=1 -h
21G     ./Latest
8.7M    ./ktest
21G     .
[root at backup backup]# rm ktest/ -rf
[root at backup backup]# cp -al Latest/ mtest/
[root at backup backup]# du --max-depth=1 -h
21G     ./Latest
8.7M    ./mtest
21G     .
[root at backup backup]# rm mtest/ -rf
[root at backup backup]# cp -al Latest/ test/
[root at backup backup]# du --max-depth=1 -h
21G     ./test
8.3M    ./Latest
21G     .

The last instance is the problem that happens quite often. Now when I
perform an rsync as such:

rsync /share/ /backup/Latest --stats --recursive --archive --times
--modify-window=1 --delete --ignore-errors --no-whole-file
--exclude-from=/var/www/html/new/var/file-exclude --progress

I get the following results:

Number of files: 53911
Number of files transferred: 52223
Total file size: 21654476720 bytes
Total transferred file size: 21654476720 bytes
Literal data: 21651840443 bytes
Matched data: 0 bytes
File list size: 992872
Total bytes sent: 21657710607
Total bytes received: 1044480

And a du gives me:

[root at backup backup]# du --max-depth=1 -h
21G     ./test
21G     ./Latest
41G     .

It appears that due to the cp -al command not working right as stated
above, the literal changes needed was everything minus the 8.3mb, when
in reality there were very few changes between 'Share' and 'Latest'.

Can someone give any guidance on this issue? There are time when this
will happen several times throughout the 30 day incremental routine so
the disk requirements are very large. How can I keep all the data in
'Latest' consistently after using the cp -al command?


More information about the rsync mailing list