Alessandro Baggi
2020-Jan-15 17:38 UTC
[CentOS] [semi-OT] C7 Possible bug but I can't determine what tool has the problem
Il 15/01/20 17:51, Jon Pruente ha scritto:> On Wed, Jan 15, 2020 at 10:18 AM Alessandro Baggi < > alessandro.baggi at gmail.com> wrote: > >> I made several test to see what happens and noticed that removing -S >> (--sparse) from rsync command problem does not occour. >> In another test, thinking about a problem on 0ed file, I tried file >> generation using /dev/urandom then /dev/zero and running rsync -avS the >> problem is disappeared. >> > https://wiki.archlinux.org/index.php/Sparse_file#Creating_sparse_files > > In short, rsync is being told to create sparse files with the -S flag, so > it does. Could you share what you did with the urandom then zero test you > mentioned? I'm curious what exact sequence of commands you used. > _______________________________________________ > CentOS mailing list > CentOS at centos.org > https://lists.centos.org/mailman/listinfo/centosHi 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 count=100 rsync -avS src/ dest/ du -h dest/testfile du -b dest/testfile for urandom: dd if=/dev/urandom of=src/testfile bs=1M count=100 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
Jon Pruente
2020-Jan-15 17:54 UTC
[CentOS] [semi-OT] C7 Possible bug but I can't determine what tool has the problem
On Wed, Jan 15, 2020 at 11:38 AM Alessandro Baggi < alessandro.baggi at gmail.com> wrote:> 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 count=100 > rsync -avS src/ dest/ > du -h dest/testfile > du -b dest/testfile > > for urandom: > > dd if=/dev/urandom of=src/testfile bs=1M count=100 > 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? > >Ah, I misunderstood what you meant. I had thought you might have created a file with urandom first and then overwrote it with zeros. This is behaving as expected with sparse files. You can create a sparse file with dd by using seek: https://www.thegeekdiary.com/how-to-create-sparse-files-in-linux-using-dd-command/
Alessandro Baggi
2020-Jan-15 18:38 UTC
[CentOS] [semi-OT] C7 Possible bug but I can't determine what tool has the problem
Il 15/01/20 18:54, Jon Pruente ha scritto:> On Wed, Jan 15, 2020 at 11:38 AM Alessandro Baggi < > alessandro.baggi at gmail.com> wrote: > >> 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 count=100 >> rsync -avS src/ dest/ >> du -h dest/testfile >> du -b dest/testfile >> >> for urandom: >> >> dd if=/dev/urandom of=src/testfile bs=1M count=100 >> 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? >> >> > Ah, I misunderstood what you meant. I had thought you might have created a > file with urandom first and then overwrote it with zeros. This is behaving > as expected with sparse files. You can create a sparse file with dd by > using seek: > https://www.thegeekdiary.com/how-to-create-sparse-files-in-linux-using-dd-command/ > _______________________________________________ > CentOS mailing list > CentOS at centos.org > https://lists.centos.org/mailman/listinfo/centosThank 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.
Seemingly Similar Threads
- [semi-OT] C7 Possible bug but I can't determine what tool has the problem
- [semi-OT] C7 Possible bug but I can't determine what tool has the problem
- [semi-OT] C7 Possible bug but I can't determine what tool has the problem
- [semi-OT] C7 Possible bug but I can't determine what tool has the problem
- Semi-OT: ipmitool or ipmicfg: set BMC to use NIC 2