[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: rsync: different target size

2010/1/19 Rick Thomas <rbthomas@pobox.com>:
> On Jan 18, 2010, at 12:20 PM, Leonardo Canducci wrote:
>> I'm using rsync -aHS to backup some stuff (mostly jpgs and docs from
>> my home) to an external usb hard drive (same ext3 fs).
>> After a backup I ran du -s to get a fast check on size and found
>> source and target to be slightly different.
>> Even using du -cb or du-cbk size doesn't match. So what's wrong?!
>> I've noticed some dir size doesn't match:
>> leo@zazzero:~$ ls -ld /media/toshiba-docs/foto/d50/
>> drwxr-xr-x 43 leo leo 4096  6 gen 11:17 /media/toshiba-docs/foto/d50/
>> leo@zazzero:~$ ls -ld /share/foto/d50/
>> drwxr-xr-x 43 leo leo 69632  6 gen 11:17 /share/foto/d50/
>> I'd like the size of the backup to be exactly the same and check sync
>> result with du.
>> BTW, is there some better fast check I could do to test rsync behavior?
>> Thanks!
>> --
>> Leonardo Canducci
> Probably you have directories that have grown and shrunk on the source
> filesystem.  They will still have the space allocated (just the actual
> directory -- not the files in it) for the file-name entries that were
> deleted.  When you transfer them to the target (in this case the USB hard
> drive), the directories are rebuilt from scratch, so they don't have space
> allocated for the deleted file-names.

That's it!
> If you want to use file sizes as a check on the operation of rsync (not the
> best check, but it will catch some kinds of errors) you could do something
> like this
> ( cd source ; find . -type f -print0 | sort -z | xargs ls -s ) >
> /tmp/source-stuff
> ( cd target ; find . -type f -print0 | sort -z | xargs ls -s ) >
> /tmp/target-stuff
> diff /tmp/target-stuff /tmp/source-stuff
> you can use something like "md5sum" in place of "ls -s" if you want a more
> industrial strength check...

how does that compare to rsync -cn? Is it faster? safer?

Leonardo Canducci

Reply to: