Hi, I'm having some strange issues when using cp in my rsync script. It seems there may be links breaking or something. Before running the actual rsync I run the following command in my script: cp -al /backup/Current /backup/$prevday Then I rsync from the source to /Current So shouldn't all my previous days have hard links back to the original /backup directory? 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? Shouldn't /Current always have the actual copy (37Gb)? Here is the results of du from the last two days. The first day it seems normal because there was about 1.4Gb of changes, but on the second day 4-8-2004 now has changed to 9.1Gb and Current is only 29Gb?? Strange. Does this mean that 4-8-2004 is no longer properly hard-linked to /Current? Would there be any difference using --link-destination in rsync and not using cp at all? [root@gfi backup]# du --max-depth=1 -h 37G ./Current 1.4G ./04-08-2004 26M ./04-09-2004 38G . [root@gfi backup]# du --max-depth=1 -h 29G ./Current 9.1G ./04-08-2004 211M ./04-09-2004 26M ./04-10-2004 39G .
Max Kipness wrote:> Hi, > > I'm having some strange issues when using cp in my rsync script. It > seems there may be links breaking or something. > > Before running the actual rsync I run the following command in my > script: > > cp -al /backup/Current /backup/$prevday > > Then I rsync from the source to /Current > > So shouldn't all my previous days have hard links back to the original > /backup directory?Perhaps you are thinking of a soft link? See the man pages link(2) and symlink(2).
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 happen.> 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. ..wayne..
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 uniquelylinked. Without that, you wouldn't have any backups in >the older dirs. Thanks for the explanation Wayne. I think I understand now that it doesn't matter which directories are seen as holding more than others. However the total for all the directories should still be accurate, right? Well as of last night the total has now jumped 9GB. Am I to assume that there was 9GB worth of changes in one day? I guess it's possible, even though it seems unusual based on my knowledge of how this data is being used. Is there anything else that could cause this sudden increase? Thanks, Max [root@gfi backup]# du --max-depth=1 -h 37G ./Current 1.4G ./04-08-2004 26M ./04-09-2004 38G . [root@gfi backup]# du --max-depth=1 -h 29G ./Current 9.1G ./04-08-2004 211M ./04-09-2004 26M ./04-10-2004 39G . [root@gfi backup]# du --max-depth=1 -h 37G ./Current 9.2G ./04-08-2004 838M ./04-09-2004 26M ./04-10-2004 24M ./04-11-2004 47G .