C7 Possible Bug But I Can’t Determine What Tool Has The Problem

Home » CentOS » C7 Possible Bug But I Can’t Determine What Tool Has The Problem
CentOS 6 Comments

Hi all,

I’m writing a script that uses rsync to sync 2 dirs on C7. I noticed a strange behaviour.

I have 2 dir: src and dest. In src dir I generate a testfile with “dd if=/dev/zero of=testfile bs=1M count=100” and when I run “du -h testfile” I get the correct result. Then I sync src/ to dest/ using “rsync -avS

6 thoughts on - C7 Possible Bug But I Can’t Determine What Tool Has The Problem

  • Il 15/01/20 17:51, Jon Pruente ha scritto:

    Hi Jon, I wrote in the first mail the script with the current order of command that I used. Try to run in a bash script and you will see the result.

    If not my sequence is:

    dd if=/dev/zero of=src/testfile bs=1M count0
    rsync -avS src/ dest/
    du -h dest/testfile du -b dest/testfile

    for urandom:

    dd if=/dev/urandom of=src/testfile bs=1M count0
    rsync -avS src/ dest/
    du -h dest/testfile du -b dest/testfile

    without –sparse the same as first sequence without -S option.

    But why du reports 0M when with -b reports correct bytes and why this happens only with zeroed file?

    I don’t know if in the original post mail script

  • Il 15/01/20 18:54, Jon Pruente ha scritto:
    Thank you for the suggestion. I meant -S of rsync to use disk space efficiently but this is a (great) misunderstood. Now I read again rsync man page (and your link) and this means “treat sparse files efficiently to save space on disk”. My question is: is rsync capable to detect sparse files from “regular”
    files? If -S is invoked and no sparse files are not in dataset, it treats those files as sparse files or “regular” files?

    Why I get different behaviour using urandom and /dev/zero? This is casual/accidental?

    Thank you again for your help.

  • That’s not a bug, that’s what sparse files are.

    In POSIX systems, it’s possible to treat a regular file like memory, and one of the things you might do with such a feature is use a file to keep track of the last time a user logged in.