LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   rsync change file size at destination (https://www.linuxquestions.org/questions/linux-software-2/rsync-change-file-size-at-destination-4175492114/)

hesisaboury 01-22-2014 01:14 AM

rsync change file size at destination
 
Hello,
i'm using rsync as backup solution,but at destination i see different size but number of file are the same .
by using
rsync -a --update --delete source destination
i saw folder size has increased but by using
rsync -az --update --delete source destination
i saw folder size at destination decreased
i use du -sh for folder size ....
any suggestion
best regards..

druuna 01-22-2014 03:02 AM

Rsync's -z option compresses the data during the transfer from source to destination, it does not influence the file size of the original and the backup.

The size of the directories itself might increase over time, this is a feature (or bug if you want) of the ext2/3/4 filesystem. If you remove files from a directory than the info stays present in the directories meta-data and as a result the directory itself seems to grow over time. The size increase is always a multitude of the block-size used on the system (4096 on most modern systems).

Also: The du command shows the file and/or directory size on a disk level (the amount of blocks it takes to store the info). This is not the same as the "actual" file size (amount of bits/bytes):
Code:

$ echo 1 > foo
$ ls -l foo
-rw-r----- 1 druuna druuna 2 jan 22 09:59 foo
$ du -sh foo
4.0K    foo

As you can see from the above foo is only 2 bytes, but it takes 4096 bytes (1 block) to store it on disk.

hesisaboury 01-22-2014 11:28 PM

Thanks druuna
I know about the difference of ls and du ... so i always use du for checking disk usage of a folder or fdisk -l .. for info i have 2 mail server one with 20G mbox and the other more than 70G .. after rsync i check disk usage ...different size i saw ..both source and destination have the file system ,block , cylinder and ... i can not explain this behavior for customers ..
rsync -a --update --delete /mbox/ mail2:/mbox

Best Regards

druuna 01-23-2014 03:06 AM

Quote:

Originally Posted by hesisaboury (Post 5103387)
so i always use du for checking disk usage of a folder or fdisk -l

I'm not sure why you would use fdisk -l, that command would show static information about the disk layout and would be useless to check space usage.

Quote:

for info i have 2 mail server one with 20G mbox and the other more than 70G
I'm assuming that these two are to be backed-up using rsync and that this is not the source and destination size. A 50G difference after running rsync would be rather odd.

Can you give an idea what the difference(s) are? Is the source side bigger or the destination side? How much of a difference is there?

Quote:

both source and destination have the file system ,block , cylinder and
The file-system and the block-size used can influence the size. It isn't clear from your answer if both sides are the same. Cylinders aren't important at all to determine file size and/or disk usage.

Quote:

after rsync i check disk usage ...different size i saw ..
Without any details and assuming that the output if the du command isn't misread we won't be able to give you any specific advise.

In general I would suggest that you:
- add the -v / --verbose flag to the rsync command(s) you use. Maybe the detailed info shows something interesting,
- recheck the content on both source and destination. Don't just run du, check if all the files are accounted for,
- make sure that the destination side isn't contaminated with other files and/or directories which where not part of the rsync process.


All times are GMT -5. The time now is 12:27 PM.