Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
share|improve this question

5 Answers 5

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.

share|improve this answer

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.

share|improve this answer

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.

share|improve this answer

Try using rsnapshot du.

share|improve this answer

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)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.