1

I'm wondering why, when I use rsnapshot to rsync /usr/lib/locate from one machine to another, the output given by 'du' is different? The machines are identical, the OS on both is CentOS 5.3.

Here is the output on the source machine:

# du -csh /usr/lib/locale
129M    /usr/lib/locale
129M    total

And the target machine (where it has been rsynced to):

# du -csh usr/lib/locale/
319M    usr/lib/locale/
319M    total

The partitions are even the same on the machines, both /var and both the same size, about 409 gigs.

One thing that is possible is that rsnapshot is resolving the symbolic links in the directory on the source into real links on the target machine. For example, on the source machine, looking for files that are not hard linked to anything:

# find /usr/lib/locale -links 1  | wc -l
1733

And then on the target machine:

# find usr/lib/locale/ -links 1 | wc -l
4597

5 Answers 5

1

When you rsync, do you use the --delete flag?

If not, then you will not remove files that have been removed from the remote machine when you do the sync, you'll only sync the files that do exist.

Also, make sure you're terminating the paths in the same way, for example...

rsync -a remote:/tmp/X ./tmp/X/

...is not the same as...

rsync -a remote:/tmp/X/ ./tmp/X/

...Before you add the --delete, make sure you do a --dry-run so you can see what would happen.

1

Also, remember to use the -S(--sparse) flag so rsync will handle little files efficiently. Else, the target for the rsync will end up way bigger.

1

Read the rsync manpage. In there you will find an option to detect and sync hardlinks. Use it along with -a. You will note a considerable decrease in space if some files in that directory are hardlinked.

0

Try using rsnapshot du.

0

Directories' sizes normally never shrink (depends on the filesystem), so a directory which used to contain a large number of files on one system, but now doesn't, will be larger than if it didn't used to contain lots.

There should be an option on du or something to ignore directories' sizes.

(NB: I mean the directory itself, not the files)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .